public class ConstantNode extends LoadNode
v = constant
| Modifier and Type | Class and Description |
|---|---|
static class |
ConstantNode.Type
The different kinds of constant values.
|
EXCEPTION_REG, FIRST_ORDINARY_REG, NO_VALUE, RETURN_REG| Modifier and Type | Method and Description |
|---|---|
boolean |
canThrowExceptions()
Returns true if this node may throw exceptions.
|
boolean |
getBoolean()
Returns the boolean (for Type.BOOLEAN only).
|
double |
getNumber()
Returns the number (for Type.NUMBER only).
|
java.lang.String |
getString()
Returns the string (for Type.STRING only).
|
ConstantNode.Type |
getType()
Returns the type.
|
static ConstantNode |
makeBoolean(boolean bool,
int result_reg,
SourceLocation location)
Constructs a new constant boolean node.
|
static ConstantNode |
makeNull(int result_reg,
SourceLocation location)
Constructs a new constant 'null' node.
|
static ConstantNode |
makeNumber(double number,
int result_reg,
SourceLocation location)
Constructs a new constant number node.
|
static ConstantNode |
makeString(java.lang.String string,
int result_reg,
SourceLocation location)
Constructs a new constant string node.
|
static ConstantNode |
makeUndefined(int result_reg,
SourceLocation location)
Constructs a new constant 'undefined' node.
|
java.lang.String |
toString()
Returns a string description of this node.
|
void |
visitBy(NodeVisitor v)
Visits this node with the given visitor.
|
getResultRegistercheck, clone, getBlock, getDuplicateOf, getImplicitAfterCall, getIndex, getSourceLocation, getThisOrDuplicateOf, isArtificial, isRegistersDone, setArtificial, setBlock, setDuplicateOf, setImplicitAfterCall, setIndex, setRegistersDone, setSourceLocationpublic boolean canThrowExceptions()
AbstractNodecanThrowExceptions in class AbstractNodepublic boolean getBoolean()
public double getNumber()
public java.lang.String getString()
public ConstantNode.Type getType()
public static ConstantNode makeBoolean(boolean bool, int result_reg, SourceLocation location)
bool - The boolean.result_reg - The register to store the boolean in.location - The source location.public static ConstantNode makeNull(int result_reg, SourceLocation location)
result_reg - The register to store the 'null' in.location - The source location.public static ConstantNode makeNumber(double number, int result_reg, SourceLocation location)
number - The number.result_reg - The register to store the number in.location - The source location.public static ConstantNode makeString(java.lang.String string, int result_reg, SourceLocation location)
string - The string.result_reg - The register to store the string in.location - The source location.public static ConstantNode makeUndefined(int result_reg, SourceLocation location)
result_reg - The register to store the undefined in.location - The source location.public java.lang.String toString()
AbstractNodetoString in class AbstractNodepublic void visitBy(NodeVisitor v)
NodeCopyright © 2009-2019 Aarhus University