Package jminusminus
Class JMethodDeclaration
java.lang.Object
jminusminus.JAST
jminusminus.JMethodDeclaration
- All Implemented Interfaces:
JMember
- Direct Known Subclasses:
JConstructorDeclaration
The AST node for a method declaration.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected JBlockMethod body.protected MethodContextMethod context (built in analyze()).protected StringMethod descriptor (computed in preAnalyze()).Exceptions thrown.protected booleanIs this method abstract?protected booleanIs this method private?protected booleanIs this method static?Method modifiers.protected StringMethod name.protected ArrayList<JFormalParameter>The formal parameters.protected TypeReturn type.Fields inherited from class jminusminus.JAST
compilationUnit, line -
Constructor Summary
ConstructorsConstructorDescriptionJMethodDeclaration(int line, ArrayList<String> mods, String name, Type returnType, ArrayList<JFormalParameter> params, ArrayList<TypeName> exceptions, JBlock body) Constructs an AST node for a method declaration. -
Method Summary
Modifier and TypeMethodDescriptionPerforms semantic analysis on this AST and returns the (possibly modified) AST.voidPerforms code generation for this AST.voidpartialCodegen(Context context, CLEmitter partial) Generates a partial class for a type, reflecting only the member information required to do analysis.voidpreAnalyze(Context context, CLEmitter partial) Declares the member names in the specified (class) context and generates the member headers in the partial class.voidtoJSON(JSONElement json) Stores information about this AST in JSON format.
-
Field Details
-
mods
Method modifiers. -
name
Method name. -
returnType
Return type. -
params
The formal parameters. -
exceptions
Exceptions thrown. -
body
Method body. -
context
Method context (built in analyze()). -
descriptor
Method descriptor (computed in preAnalyze()). -
isAbstract
protected boolean isAbstractIs this method abstract? -
isStatic
protected boolean isStaticIs this method static? -
isPrivate
protected boolean isPrivateIs this method private?
-
-
Constructor Details
-
JMethodDeclaration
public JMethodDeclaration(int line, ArrayList<String> mods, String name, Type returnType, ArrayList<JFormalParameter> params, ArrayList<TypeName> exceptions, JBlock body) Constructs an AST node for a method declaration.- Parameters:
line- line in which the method declaration occurs in the source file.mods- modifiers.name- method name.returnType- return type.params- the formal parameters.exceptions- exceptions thrown.body- method body.
-
-
Method Details
-
preAnalyze
Declares the member names in the specified (class) context and generates the member headers in the partial class.- Specified by:
preAnalyzein interfaceJMember- Parameters:
context- class context in which names are resolved.partial- the code emitter.
-
analyze
Performs semantic analysis on this AST and returns the (possibly modified) AST. -
partialCodegen
Generates a partial class for a type, reflecting only the member information required to do analysis.- Overrides:
partialCodegenin classJAST- Parameters:
context- the parent (class) context.partial- the code emitter.
-
codegen
Performs code generation for this AST. -
toJSON
Stores information about this AST in JSON format.
-