Package jminusminus
Class JClassDeclaration
java.lang.Object
jminusminus.JAST
jminusminus.JClassDeclaration
- All Implemented Interfaces:
JTypeDecl
A representation of a class declaration.
-
Field Summary
Fields inherited from class jminusminus.JAST
compilationUnit, line
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionPerforms semantic analysis on this AST and returns the (possibly modified) AST.void
Performs code generation for this AST.void
declareThisType
(Context context) Declares this type in the parent context.Returns the initializations for instance fields (expressed as assignment statements).name()
Returns the name of this type declaration.void
preAnalyze
(Context context) Pre-analyzes the members of this declaration in the parent context.Returns the types of the implemented interfaces for a class or extended interfaces for an interface.Returns the type of the extended class for a class or java.lang.Object for an interface.thisType()
Returns the type that this type declaration defines.void
toJSON
(JSONElement json) Stores information about this AST in JSON format.Methods inherited from class jminusminus.JAST
line, partialCodegen, unescape
-
Constructor Details
-
JClassDeclaration
public JClassDeclaration(int line, ArrayList<String> mods, String name, Type superType, ArrayList<TypeName> superInterfaces, ArrayList<JMember> classBlock) Constructs an AST node for a class declaration.- Parameters:
line
- line in which the class declaration occurs in the source file.mods
- class modifiers.name
- class name.superType
- super class type.superInterfaces
- implemented interfaces.classBlock
- class block.
-
-
Method Details
-
instanceFieldInitializations
Returns the initializations for instance fields (expressed as assignment statements).- Returns:
- the initializations for instance fields (expressed as assignment statements).
-
declareThisType
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 interfaceJTypeDecl
- Parameters:
context
- the parent (compilation unit) context.
-
preAnalyze
Pre-analyzes the members of this declaration in the parent context.- Specified by:
preAnalyze
in interfaceJTypeDecl
- Parameters:
context
- the parent (compilation unit) context.
-
name
Returns the name of this type declaration. -
thisType
Returns the type that this type declaration defines. -
superType
Returns the type of the extended class for a class or java.lang.Object for an interface. -
superInterfaces
Returns the types of the implemented interfaces for a class or extended interfaces for an interface.- Specified by:
superInterfaces
in interfaceJTypeDecl
- Returns:
- the types of the implemented interfaces for a class or extended interfaces for an interface.
-
analyze
Performs semantic analysis on this AST and returns the (possibly modified) AST. -
codegen
Performs code generation for this AST. -
toJSON
Stores information about this AST in JSON format.
-