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
Modifier and TypeFieldDescriptionprotected JBlock
Method body.protected MethodContext
Method context (built in analyze()).protected String
Method descriptor (computed in preAnalyze()).Exceptions thrown.protected boolean
Is this method abstract?protected boolean
Is this method private?protected boolean
Is this method static?Method modifiers.protected String
Method name.protected ArrayList<JFormalParameter>
The formal parameters.protected Type
Return type.Fields inherited from class jminusminus.JAST
compilationUnit, line
-
Constructor Summary
ConstructorDescriptionJMethodDeclaration
(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.void
Performs code generation for this AST.void
partialCodegen
(Context context, CLEmitter partial) Generates a partial class for a type, reflecting only the member information required to do analysis.void
preAnalyze
(Context context, CLEmitter partial) Declares the member names in the specified (class) context and generates the member headers in the partial class.void
toJSON
(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:
preAnalyze
in 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:
partialCodegen
in 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.
-