Package jminusminus
Class JVariableDeclarator
java.lang.Object
jminusminus.JAST
jminusminus.JVariableDeclarator
The AST node for a variable declarator, which declares a name, its type and (possibly)
provides an initialization.
-
Field Summary
Fields inherited from class jminusminus.JAST
compilationUnit, line
-
Constructor Summary
ConstructorDescriptionJVariableDeclarator
(int line, String name, Type type, JExpression initializer) Constructs an AST node for a variable declarator. -
Method Summary
Modifier and TypeMethodDescriptionPerforms semantic analysis on this AST and returns the (possibly modified) AST.void
Performs code generation for this AST.Returns the variable initializer.name()
Returns the variable name.void
setInitializer
(JExpression initializer) Sets the variable initializer.void
Sets the variable type.void
toJSON
(JSONElement json) Stores information about this AST in JSON format.type()
Returns the variable type.Methods inherited from class jminusminus.JAST
line, partialCodegen, unescape
-
Constructor Details
-
JVariableDeclarator
Constructs an AST node for a variable declarator.- Parameters:
line
- line in which the variable occurs in the source file.name
- variable name.type
- variable type.initializer
- initializer.
-
-
Method Details
-
name
Returns the variable name.- Returns:
- the variable name.
-
type
Returns the variable type.- Returns:
- the variable type.
-
setType
Sets the variable type.- Parameters:
type
- the type
-
initializer
Returns the variable initializer.- Returns:
- the variable initializer.
-
setInitializer
Sets the variable initializer.- Parameters:
initializer
- the initializer.
-
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.
-