class JVariableDeclarator extends JAST
Modifier and Type | Field and Description |
---|---|
boolean |
isInitialized |
compilationUnit, line
Constructor and Description |
---|
JVariableDeclarator(int line,
String name,
Type type,
JExpression initializer)
Construct an AST node for a variable declarator given the line number,
variable name, its type, and the initializer.
|
Modifier and Type | Method and Description |
---|---|
JVariableDeclarator |
analyze(Context context)
No analysis is done here.
|
void |
codegen(CLEmitter output)
No code generation is done here.
|
JExpression |
initializer()
Return the variable initializer.
|
String |
name()
Return the variable name.
|
void |
setInitializer(JExpression initial)
Set the variable initializer.
|
void |
setType(Type type)
Set the declarator's type.
|
Type |
type()
Return the variable type.
|
void |
writeToStdOut(PrettyPrinter p)
Write the information pertaining to this AST to STDOUT.
|
line, partialCodegen
public JVariableDeclarator(int line, String name, Type type, JExpression initializer)
line
- line in which the variable occurs in the source file.name
- variable name.type
- variable type.initializer
- initializer.public String name()
public Type type()
public void setType(Type type)
type
- the new typepublic JExpression initializer()
public void setInitializer(JExpression initial)
initial
- initializer.public JVariableDeclarator analyze(Context context)
public void codegen(CLEmitter output)
public void writeToStdOut(PrettyPrinter p)
JAST
writeToStdOut
in class JAST
p
- for pretty printing with indentation.