|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface LoadLiteralInstruction
x = l, an assignment of a literal value to a variable.
Example:
a = 4;
Method Summary | |
---|---|
Object |
getLiteral()
This method returns the literal that is being assigned in this 3 address code statement. |
ASTNode |
getNode()
Returns the node this instruction is for. |
boolean |
isNonNullString()
Indicates whether this loads a string
literal. |
boolean |
isNull()
Indicates whether this loads the null literal. |
boolean |
isNumber()
Indicates the load of a number such as an int . |
boolean |
isPrimitive()
Indicates the load of a primitive value. |
Methods inherited from interface edu.cmu.cs.crystal.tac.model.AssignmentInstruction |
---|
getTarget |
Methods inherited from interface edu.cmu.cs.crystal.tac.model.TACInstruction |
---|
transfer, transfer |
Method Detail |
---|
ASTNode getNode()
Expression
. Usually,
one instruction exists per AST node, but can be more
when AST nodes are desugared, such as for post-increment.
getNode
in interface TACInstruction
TACInstruction.getNode()
Object getLiteral()
isPrimitive()
and isNull()
methods may be helpful here if you are trying to do something clever
based on which literal is actually being assigned.instanceof
tests
on the return value and cast it into something that is actually helpful.
Right now numeric literals are returned as Strings; this may be cleaned
up in the future. Boolean literals are (as you would expect)
represented as Booleans, null literals as null, and char literals as
Characters.
boolean isPrimitive()
true
if this is a load of a primitive value,
false
otherwise.boolean isNumber()
int
.
Implies isPrimitive()
true
if this is a load of a number,
false
otherwise.boolean isNull()
null
literal.
true
if this loads the null
literal, false
otherwise.boolean isNonNullString()
string
literal.
true
if this loads a string
,
false
otherwise.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |