Package jminusminus

Class JForStatement


class JForStatement extends JStatement
The AST node for a for-statement.
  • Constructor Details

    • JForStatement

      public JForStatement(int line, ArrayList<JStatement> init, JExpression condition, ArrayList<JStatement> update, JStatement body)
      Constructs an AST node for a for-statement.
      Parameters:
      line - line in which the for-statement occurs in the source file.
      init - the initialization.
      condition - the test expression.
      update - the update.
      body - the body.
  • Method Details

    • analyze

      public JForStatement analyze(Context context)
      Performs semantic analysis on this AST and returns the (possibly modified) AST.
      Specified by:
      analyze in class JAST
      Parameters:
      context - the environment (scope) in which code is analyzed.
      Returns:
      the (possibly modified) AST.
    • codegen

      public void codegen(CLEmitter output)
      Performs code generation for this AST.
      Specified by:
      codegen in class JAST
      Parameters:
      output - the code emitter.
    • toJSON

      public void toJSON(JSONElement json)
      Stores information about this AST in JSON format.
      Overrides:
      toJSON in class JAST
      Parameters:
      json - the JSON emitter.