|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.millscript.millscript.expr.Expr<PushAction>
org.millscript.millscript.expr.NameExpr
public final class NameExpr
This class implements a name expression. This expression can only return one result, which will be the value associated with the name.
PushAlienAction,
PushLocalAction,
PushGlobalAction| Constructor Summary | |
|---|---|
NameExpr(java.lang.String s)
Creates a new name expression for the specified symbol. |
|
| Method Summary | |
|---|---|
PushAction |
compileIt()
Compiles this expression into an action. |
void |
declareGlobal(CompilerState state,
boolean isConst)
Declares this name expression to be a global identifier in the specified compiler state, with the specified constant state. |
void |
declareLocal(boolean isConst)
Declares this name expression to be a local identifier, with the specified constant state. |
Ident |
getIdent()
Returns the ident for this name expression. |
java.lang.String |
getName()
Returns the symbol for this name expression. |
java.lang.String |
getNickname()
Returns the package nickname for this name expression. |
void |
resolve(CompilerState state)
Resolves any NameExpr in the tree so that they refer to the
correct ident. |
void |
setIdent(Ident id)
Sets this name expressions ident to that specified. |
void |
setNickname(java.lang.String s)
Sets the package nickname for this name expression. |
void |
show(int n)
Displays details about this expression, with the specified indent level. |
| Methods inherited from class org.millscript.millscript.expr.Expr |
|---|
arity, compile, isIntegerExpr, resolveList, setLineNumber, setOrigin, show |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public NameExpr(java.lang.String s)
s - the symbol for this name expression| Method Detail |
|---|
public PushAction compileIt()
compileIt in class Expr<PushAction>PushAlienAction, PushLocalAction or a
PushGlobalAction for this expression, depending on the
type of variable this name represents
public void declareGlobal(CompilerState state,
boolean isConst)
state - the compiler state in which to declare this name a
global identifierisConst - a boolean indicating if this new global identifier is a
constantpublic void declareLocal(boolean isConst)
isConst - a boolean indicating if this new local identifier is a
constantpublic Ident getIdent()
Ident for this namepublic java.lang.String getName()
public java.lang.String getNickname()
public void resolve(CompilerState state)
ExprNameExpr in the tree so that they refer to the
correct ident. e.g. This method is responsible for ensuring that
references to a function argument in the body of a function actually
refer to the correct value.
resolve in class Expr<PushAction>state - the compiler state we are resolving in
A name expression has a complicated renaming process. This is responsible
for ensuring idents are shared properly, so that variables of the same
name really do refer to the same variable.
public void setIdent(Ident id)
id - the ident for this name expressionpublic void setNickname(java.lang.String s)
s - the package nickname for this name expressionpublic void show(int n)
Expr
show in class Expr<PushAction>n - the indent level at which to start displayingExpr.show(int)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||