public class NameID extends IDExpression
Identifier for
better IR consistency. Identifier is used only for variables which
are part of expression tree,
whereas NameID is for other types of traversable objects that do not
need to refer to the declared variables. One suggestion for pass writers is
that avoid using Identifier if the object is not going
to have any access to the declared symbol. This means an Identifier
object is created only through the constructor
Identifier.Identifier(Symbol).
Following example explicates the * uses of these two types of
IDExpression.
... int a = b+1; // a is a NameID object, b is an Identifier object. a += ... // a is an Identifier object. ...
| Constructor and Description |
|---|
NameID(java.lang.String name)
Constructs a new named ID with the given string name.
|
| Modifier and Type | Method and Description |
|---|---|
NameID |
clone()
Returns a clone of this named ID.
|
static void |
defaultPrint(NameID i,
java.io.PrintWriter o)
Prints the name of this ID to the given writer.
|
boolean |
equals(java.lang.Object o)
Checks if the given object o is equal to this named ID.
|
java.lang.String |
getName()
Returns the string name of this named ID.
|
int |
hashCode()
Returns the hash code of this named ID.
|
void |
setName(java.lang.String new_name)
Sets the name of this ID with the given new name.
|
java.lang.String |
toString()
Returns a string representation of this named ID.
|
findDeclaration, setGlobal, setTypenamecompareTo, findExpression, getChildren, getParent, getStatement, needsParens, print, printSelf, removeChild, setChild, setParens, setParent, setPrintMethod, swapWith, verifypublic NameID(java.lang.String name)
name - the name of this named ID.public java.lang.String getName()
getName in class IDExpressionpublic void setName(java.lang.String new_name)
new_name - the new string name for this named ID.public static void defaultPrint(NameID i, java.io.PrintWriter o)
i - the named ID to be printed.o - the print writer.public NameID clone()
clone in class IDExpressionpublic java.lang.String toString()
toString in class Expressionpublic boolean equals(java.lang.Object o)
equals in class Expressiono - the object to be checked for equality.o.hashCode() == this.hashCode().public int hashCode()
hashCode in class Expression