public class VariableDeclaration extends Statement
Modifier and Type | Field and Description |
---|---|
ExpressionList |
initializers
(¬ø) The initializing expressions for the declared variables,
null
being an allowable value. |
boolean |
isFinal
Whether or not the argument was modified as final.
|
NameList |
names
(¬ø) The names of variables declared in this statement.
|
Type |
type
(¬ø) The type of the declared variable.
|
byteOffset, line, nodeID, symbolTable
Constructor and Description |
---|
VariableDeclaration(Name n)
Parser's constructor, leaving the type to be filled in later.
|
VariableDeclaration(Name n,
Expression i)
Parser's constructor, leaving the type to be filled in later.
|
VariableDeclaration(Type t,
NameList n,
ExpressionList i,
boolean f)
Full constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addVariables(VariableDeclaration v)
Adds the declarations in the specified declaration statement to the declarations in this
statement.
|
Object |
clone()
Creates a new object with the same primitive data, and recursively creates new member data
objects as well.
|
boolean |
equals(Object o)
Distinguishes this
ASTNode from other objects according to its contents recursively. |
int |
hashCode()
Returns a hash code for this
ASTNode . |
ASTNodeIterator |
iterator()
Returns an iterator used to successively access the children of this node.
|
void |
runPass(Pass pass)
Ensures that the correct
run() method is called for this type of node. |
void |
setType(Type t)
Setting this declaration statement's type also sets its line and byte offset information.
|
void |
write(StringBuffer buffer)
Writes a string representation of this
ASTNode to the specified buffer. |
public boolean isFinal
public Type type
public NameList names
public ExpressionList initializers
null
being an allowable value.public VariableDeclaration(Name n)
n
- The name of the declared variable.public VariableDeclaration(Name n, Expression i)
n
- The name of the declared variable.i
- The initializing expression for the declared variable.public VariableDeclaration(Type t, NameList n, ExpressionList i, boolean f)
t
- The type of the declared variables.n
- The names of the declared variables.i
- The initializing expressions for the declared variables.f
- Whether or not the variables were declared as final.public void addVariables(VariableDeclaration v)
v
- The variables to be added.public void setType(Type t)
t
- The new type for this variable declaration statement.public ASTNodeIterator iterator()
public Object clone()
public int hashCode()
ASTNode
.public boolean equals(Object o)
ASTNode
from other objects according to its contents recursively.public void runPass(Pass pass)
run()
method is called for this type of node.public void write(StringBuffer buffer)
ASTNode
to the specified buffer. The
representation written is parsable by the LBJava compiler, but not very readable.Copyright © 2016. All rights reserved.