Package jminusminus

Class JFormalParameter

java.lang.Object
jminusminus.JAST
jminusminus.JFormalParameter

class JFormalParameter extends JAST
The AST node for a formal parameter declaration.
  • Constructor Details

    • JFormalParameter

      public JFormalParameter(int line, String name, Type type)
      Constructs an AST node for a formal parameter declaration.
      Parameters:
      line - line in which the parameter occurs in the source file.
      name - parameter name.
      type - parameter type.
  • Method Details

    • name

      public String name()
      Returns the parameter's name.
      Returns:
      the parameter's name.
    • type

      public Type type()
      Returns the parameter's type.
      Returns:
      the parameter's type.
    • setType

      public Type setType(Type newType)
      Sets the parameter's type to the specified type, and returns the new type.
      Parameters:
      newType - the new type.
      Returns:
      return the new type.
    • analyze

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