Package jminusminus

Class JBlock


class JBlock extends JStatement
The AST node for a block, which delimits a nested level of scope.
  • Constructor Details

    • JBlock

      public JBlock(int line, ArrayList<JStatement> statements)
      Constructs an AST node for a block.
      Parameters:
      line - line in which the block occurs in the source file.
      statements - list of statements forming the block body.
  • Method Details

    • statements

      public ArrayList<JStatement> statements()
      Returns the list of statements comprising this block.
      Returns:
      the list of statements comprising this block.
    • analyze

      public JBlock 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.