Package iota

Class IMethodDeclaration

java.lang.Object
iota.IAST
iota.IMethodDeclaration

class IMethodDeclaration extends IAST
The AST node for a method declaration.
  • Field Details

    • mods

      protected ArrayList<String> mods
      Method modifiers.
    • name

      protected String name
      Method name.
    • returnType

      protected Type returnType
      Return type.
    • params

      protected ArrayList<IFormalParameter> params
      The formal parameters.
    • body

      protected IBlock body
      Method body.
    • context

      protected MethodContext context
      Method context (built in analyze()).
    • descriptor

      protected String descriptor
      Method descriptor (computed in preAnalyze()).
    • signature

      protected String signature
      Method signature (also computed in preAnalyze()).
  • Constructor Details

    • IMethodDeclaration

      public IMethodDeclaration(int line, String name, Type returnType, ArrayList<IFormalParameter> params, IBlock body)
      Constructs an AST node for a method declaration.
      Parameters:
      line - line in which the method declaration occurs in the source file.
      name - method name.
      returnType - return type.
      params - the formal parameters.
      body - method body.
  • Method Details

    • preAnalyze

      public void preAnalyze(Context context, CLEmitter partial)
      Performs first phase of semantic analysis on this AST.
      Overrides:
      preAnalyze in class IAST
      Parameters:
      context - the environment (scope) in which code is pre-analyzed.
      partial - the code emitter.
    • analyze

      public IAST analyze(Context context)
      Performs second phase of semantic analysis on this AST and returns the (possibly modified) AST.
      Specified by:
      analyze in class IAST
      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 IAST
      Parameters:
      output - the code emitter.
    • toJSON

      public void toJSON(JSONElement json)
      Adds information pertaining to this context to the given JSON element.
      Overrides:
      toJSON in class IAST
      Parameters:
      json - JSON element.