|
JML | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.multijava.util.Utils
org.multijava.util.compiler.Phylum
org.multijava.mjc.JPhylum
org.multijava.mjc.JLocalVariable
This class represents a local variable declaration in the AST.
| Field Summary | |
private boolean |
assigned
|
static int |
DES_CATCH_PARAMETER
|
static int |
DES_GENERATED
|
static int |
DES_LOCAL_VAR
|
static int |
DES_PARAMETER
|
private int |
desc
|
protected JExpression |
expr
|
private int |
index
|
private boolean |
loopVariable
|
protected long |
modifiers
|
protected String |
name
|
private int |
position
|
protected CType |
type
|
private boolean |
used
|
| Fields inherited from class org.multijava.mjc.JPhylum |
EMPTY |
| Fields inherited from class org.multijava.util.compiler.Phylum |
|
| Fields inherited from class org.multijava.util.Utils |
DBG_LEVEL_HIGH, DBG_LEVEL_LOW, DBG_LEVEL_NO |
| Constructor Summary | |
JLocalVariable(TokenReference where,
long modifiers,
int desc,
CType type,
String name,
JExpression expr)
Constructs a local variable definition AST node. |
|
| Method Summary | |
boolean |
equals(Object o)
Returns true if the given object should be consider equal to this. |
JExpression |
expr()
|
private boolean |
exprIsArrayExpression()
|
void |
genLoad(CodeSequence code)
Generates a sequence of bytecode to load the value of the variable on the stack |
void |
genStore(CodeSequence code)
Generates a sequence of bytecodes |
int |
getDescription()
|
int |
getPosition()
Returns the index of this variable in the stack frame for the method in which it is declared. |
CType |
getType()
|
JExpression |
getValue()
|
int |
hashCode()
|
String |
ident()
Returns the (unqualified) identifier for the slot. |
int |
index()
Returns the index of this variable in the local block in which it is declared. |
boolean |
isAssigned()
|
boolean |
isConstant()
|
boolean |
isDeclaredNonNull()
|
boolean |
isFinal()
Returns if this variable is final |
private boolean |
isFinalNonNull()
|
boolean |
isGenerated()
Returns the variable definied by this formal parameter |
boolean |
isLoopVariable()
|
boolean |
isNonNull(CContextType context)
|
boolean |
isStatic()
Returns if this variable is static |
boolean |
isUsed()
|
long |
modifiers()
|
void |
setAssigned(TokenReference ref,
CContextType context)
Records that this variable is assigned to and reports a warning if the assignment is to a for-loop variable in a location other than the increment of the loop. |
void |
setIdent(String name)
Sets the identifier of this local variable. |
void |
setIndex(int index)
Sets the index of this variable in the local block in which it is declared. |
void |
setIsLoopVariable()
Registers that this variable is an index variable for a for-loop. |
void |
setModifiers(long modifiers)
set the modifiers of this variable |
void |
setNonNull()
Make this declarator (implicitly) non-null. |
void |
setPosition(int position)
Sets the index of this variable in the stack frame for the method in which it is declared. |
void |
setUsed()
|
void |
setValue(JExpression expr)
Sets the initialization expression for this local variable. |
String |
toString()
|
void |
typecheck(CFlowControlContextType context)
Typechecks the local variable and mutates the context to record information gathered during typechecking. |
void |
unsetIsLoopVariable()
De-registers that this variable is an index variable for a for-loop. |
| Methods inherited from class org.multijava.mjc.JPhylum |
accept, check, check, check, check, fail, fail, fail, warn, warn, warn, warn |
| Methods inherited from class org.multijava.util.compiler.Phylum |
getTokenReference, setTokenReference |
| Methods inherited from class org.multijava.util.Utils |
assertTrue, assertTrue, combineArrays, escapeString, escapeString, fail, fail, getFilePath, hasFlag, hasOtherFlags, parsePathParts, relativePathTo, splitQualifiedName, splitQualifiedName, stripJavaModifiers, stripNonJavaModifiers, stripPrivateModifier, unescapeString, vectorToArray, vectorToIntArray |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final int DES_LOCAL_VAR
public static final int DES_PARAMETER
public static final int DES_CATCH_PARAMETER
public static final int DES_GENERATED
private int desc
private boolean used
private boolean assigned
private boolean loopVariable
protected long modifiers
protected String name
protected CType type
protected JExpression expr
private int index
private int position
| Constructor Detail |
public JLocalVariable(TokenReference where,
long modifiers,
int desc,
CType type,
String name,
JExpression expr)
where - the location of the declaration of this variablemodifiers - the modifiers on this variabledesc - the sort of variable this is (see constants)type - the type of this variablename - the name of this variableexpr - the initializing expression for this variable| Method Detail |
public boolean isFinal()
isFinal in interface VariableDescriptorpublic boolean isStatic()
public boolean isGenerated()
public long modifiers()
public void setModifiers(long modifiers)
public String ident()
VariableDescriptor
ident in interface VariableDescriptorpublic void setIdent(String name)
public CType getType()
public boolean isNonNull(CContextType context)
public boolean isDeclaredNonNull()
private boolean isFinalNonNull()
private boolean exprIsArrayExpression()
public void setNonNull()
public void setValue(JExpression expr)
public JExpression getValue()
public boolean isConstant()
public int index()
index in interface VariableDescriptorpublic void setIndex(int index)
public int getDescription()
public int getPosition()
public void setPosition(int position)
public void setUsed()
public boolean isUsed()
public void setAssigned(TokenReference ref,
CContextType context)
setIsLoopVariable(),
unsetIsLoopVariable(),
setAssigned(TokenReference,CContextType)public boolean isAssigned()
public void setIsLoopVariable()
unsetIsLoopVariable(),
setAssigned(TokenReference,CContextType)public void unsetIsLoopVariable()
setIsLoopVariable(),
setAssigned(TokenReference,CContextType)public boolean isLoopVariable()
public boolean equals(Object o)
o is any instance of JLocalVariable
with the same index as this. Thus "false
positives" may result if this method is called on two
JLocalVariables from different lexical
contexts. !FIXME!
equals in class Objecto - the object to compare against
public int hashCode()
hashCode in class Objectpublic JExpression expr()
public void typecheck(CFlowControlContextType context)
throws PositionedError
context - the context in which this expression appears
PositionedError - if the check fails public void genLoad(CodeSequence code)
code - the code sequencepublic void genStore(CodeSequence code)
code - the code sequencepublic String toString()
toString in class Object
|
JML | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||