Package jminusminus

Class JInterfaceDeclaration

java.lang.Object
jminusminus.JAST
jminusminus.JInterfaceDeclaration
All Implemented Interfaces:
JTypeDecl

class JInterfaceDeclaration extends JAST implements JTypeDecl
A representation of an interface declaration.
  • Constructor Details

    • JInterfaceDeclaration

      public JInterfaceDeclaration(int line, ArrayList<String> mods, String name, ArrayList<TypeName> superInterfaces, ArrayList<JMember> interfaceBlock)
      Constructs an AST node for an interface declaration.
      Parameters:
      line - line in which the interface declaration occurs in the source file.
      mods - class modifiers.
      name - class name.
      superInterfaces - super class types.
      interfaceBlock - interface block.
  • Method Details

    • declareThisType

      public void declareThisType(Context context)
      Declares this type in the parent context. Called before pre-analysis so that it is available in the preAnalyze() method of other types.
      Specified by:
      declareThisType in interface JTypeDecl
      Parameters:
      context - the parent (compilation unit) context.
    • preAnalyze

      public void preAnalyze(Context context)
      Pre-analyzes the members of this declaration in the parent context.
      Specified by:
      preAnalyze in interface JTypeDecl
      Parameters:
      context - the parent (compilation unit) context.
    • name

      public String name()
      Returns the name of this type declaration.
      Specified by:
      name in interface JTypeDecl
      Returns:
      the name of this type declaration.
    • superType

      public Type superType()
      Returns the type of the extended class for a class or java.lang.Object for an interface.
      Specified by:
      superType in interface JTypeDecl
      Returns:
      the type of the extended class for a class or java.lang.Object for an interface.
    • superInterfaces

      public ArrayList<TypeName> superInterfaces()
      Returns the types of the implemented interfaces for a class or extended interfaces for an interface.
      Specified by:
      superInterfaces in interface JTypeDecl
      Returns:
      the types of the implemented interfaces for a class or extended interfaces for an interface.
    • thisType

      public Type thisType()
      Returns the type that this type declaration defines.
      Specified by:
      thisType in interface JTypeDecl
      Returns:
      the type defined by this type declaration.
    • 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.
    • toJSON

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