class JClassDeclaration extends JAST implements JTypeDecl
compilationUnit, line
Constructor and Description |
---|
JClassDeclaration(int line,
ArrayList<String> mods,
String name,
Type superType,
ArrayList<JMember> classBlock)
Construct an AST node for a class declaration given the line number, list
of class modifiers, name of the class, its super class type, and the
class block.
|
Modifier and Type | Method and Description |
---|---|
JAST |
analyze(Context context)
Perform semantic analysis on the class and all of its members within the
given context.
|
void |
codegen(CLEmitter output)
Generate code for the class declaration.
|
void |
declareThisType(Context context)
Declare this class in the parent (compilation unit) context.
|
ArrayList<JFieldDeclaration> |
instanceFieldInitializations()
The initializations for instance fields (now expressed as assignment
statments).
|
String |
name()
Return the class name.
|
void |
preAnalyze(Context context)
Pre-analyze the members of this declaration in the parent context.
|
Type |
superType()
Return the class' super class type.
|
Type |
thisType()
Return the type that this class declaration defines.
|
void |
writeToStdOut(PrettyPrinter p)
Write the information pertaining to this AST to STDOUT.
|
line, partialCodegen
public JClassDeclaration(int line, ArrayList<String> mods, String name, Type superType, ArrayList<JMember> classBlock)
line
- line in which the class declaration occurs in the source file.mods
- class modifiers.name
- class name.superType
- super class type.classBlock
- class block.public String name()
public Type superType()
public Type thisType()
public ArrayList<JFieldDeclaration> instanceFieldInitializations()
public void declareThisType(Context context)
declareThisType
in interface JTypeDecl
context
- the parent (compilation unit) context.public void preAnalyze(Context context)
preAnalyze
in interface JTypeDecl
context
- the parent (compilation unit) context.public JAST analyze(Context context)
public void codegen(CLEmitter output)
public void writeToStdOut(PrettyPrinter p)
JAST
writeToStdOut
in class JAST
p
- for pretty printing with indentation.