Class PeepholeCollectPropertyAssignments


  • public class PeepholeCollectPropertyAssignments
    extends java.lang.Object
    A pass that looks for assignments to properties of an object or array immediately following its creation using the abbreviated syntax.

    E.g. var a = [];a[0] = 0 is optimized to var a = [0] and similarly for the object constructor.

    • 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PeepholeCollectPropertyAssignments

        public PeepholeCollectPropertyAssignments()
    • 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 type
        n - 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?)