Package com.google.javascript.jscomp
Class StatementFusion
- java.lang.Object
-
- com.google.javascript.jscomp.StatementFusion
-
public class StatementFusion extends java.lang.Object
Tries to fuse all the statements in a block into a one statement by using COMMAs. Because COMMAs has the lowest precedence, we never need to insert extra () around. Once we have only one statement in a block, we can then eliminate a pair of {}'s. Further more, we can also fold a single statement IF into && or create further opportunities for all the other goodies inPeepholeSubstituteAlternateSyntax
.
-
-
Constructor Summary
Constructors Constructor Description StatementFusion()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
areNodesEqualForInlining(Node n1, Node n2)
Are the nodes equal for the purpose of inlining? If type aware optimizations are on, type equality is checked.protected boolean
isASTNormalized()
Is the current AST normalized? (e.g.protected void
report(DiagnosticType diagnostic, Node n)
Helper method for reporting an error to the compiler when applying a peephole optimization.protected void
reportCodeChange()
Helper method for telling the compiler that something has changed.
-
-
-
Method Detail
-
report
protected void report(DiagnosticType diagnostic, Node n)
Helper method for reporting an error to the compiler when applying a peephole optimization.- Parameters:
diagnostic
- The error typen
- The node for which the error should be reported
-
reportCodeChange
protected void reportCodeChange()
Helper method for telling the compiler that something has changed. Subclasses must call these if they have changed the AST.
-
areNodesEqualForInlining
protected boolean areNodesEqualForInlining(Node n1, Node n2)
Are the nodes equal for the purpose of inlining? If type aware optimizations are on, type equality is checked.
-
isASTNormalized
protected boolean isASTNormalized()
Is the current AST normalized? (e.g. has the Normalize pass been run and has the Denormalize pass not yet been run?)
-
-