Class Statement

java.lang.Object
com.oracle.js.parser.ir.Node
com.oracle.js.parser.ir.Statement
All Implemented Interfaces:
Terminal, Cloneable
Direct Known Subclasses:
BlockStatement, CatchNode, DebuggerNode, EmptyNode, ExpressionStatement, IfNode, JumpStatement, LabelNode, LoopNode, ReturnNode, SwitchNode, ThrowNode, TryNode, VarNode, WithNode

public abstract class Statement extends Node implements Terminal
Statement is something that becomes code and can be stepped past. A block is made up of statements. The only node subclass that needs to keep token and location information is the Statement
  • Constructor Details

    • Statement

      public Statement(int lineNumber, long token, int finish)
      Constructor
      Parameters:
      lineNumber - line number
      token - token
      finish - finish
    • Statement

      public Statement(int lineNumber, long token, int start, int finish)
      Constructor
      Parameters:
      lineNumber - line number
      token - token
      start - start
      finish - finish
    • Statement

      protected Statement(Statement node)
      Copy constructor
      Parameters:
      node - source node
  • Method Details

    • getLineNumber

      public int getLineNumber()
      Return the line number
      Returns:
      line number
    • isTerminal

      public boolean isTerminal()
      Is this a terminal statement, i.e. does it end control flow like a throw or return?
      Specified by:
      isTerminal in interface Terminal
      Returns:
      true if this node statement is terminal
    • hasGoto

      public boolean hasGoto()
      Check if this statement repositions control flow with goto like semantics, for example BreakNode or a ForNode with no test
      Returns:
      true if statement has goto semantics
    • hasTerminalFlags

      public final boolean hasTerminalFlags()
      Check if this statement has terminal flags, i.e. ends or breaks control flow
      Returns:
      true if has terminal flags
    • isCompletionValueNeverEmpty

      public boolean isCompletionValueNeverEmpty()
      Returns:
      true if the completion value of this statement is never the value empty