Class AstAnalyzer


  • public class AstAnalyzer
    extends java.lang.Object
    Logic for answering questions about portions of the AST.

    What kind of methods should go here?

    Methods that answer questions about some portion of the AST and that may require global information about the compilation, generally taking at least one Node as an argument. For example:

    • Does a node have side effects?
    • Can we statically determine the value of a node?

    What kind of logic should not go here?

    Really simple logic that requires no global information, like finding the parameter list node of a function, should be in NodeUtil. Logic that creates new Nodes or modifies the AST should go in AstFactory.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean mayHaveSideEffects​(Node n)
      Returns true if the node which may have side effects when executed.
      • Methods inherited from class java.lang.Object

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

      • mayHaveSideEffects

        public boolean mayHaveSideEffects​(Node n)
        Returns true if the node which may have side effects when executed. This version default to the "safe" assumptions when the compiler object is not provided (RegExp have side-effects, etc).