Term.Instance
Modifier and Type | Field and Description |
---|---|
protected LocalInstance |
li |
protected Id |
name |
exceptions, reachable
Constructor and Description |
---|
Local_c(Position pos,
Id name) |
Local_c(Position pos,
Id name,
Ext ext) |
Modifier and Type | Method and Description |
---|---|
<T> java.util.List<T> |
acceptCFG(CFGBuilder<?> v,
java.util.List<T> succs)
Visit this term in evaluation order, calling v.edge() for each successor
in succs, if data flows on that edge.
|
Node |
buildTypes(TypeBuilder tb)
Collects classes, methods, and fields from the AST rooted at this node
and constructs type objects for these.
|
java.lang.Object |
constantValue(Lang lang)
Return the constant value of the expression, if any.
|
boolean |
constantValueSet(Lang lang)
Return true iff the compiler has determined whether this expression has a
constant value.
|
Node |
copy(NodeFactory nf)
Produce a copy of this node using the given NodeFactory.
|
void |
dump(CodeWriter w)
Dump the AST node for debugging purposes.
|
Node |
extRewrite(ExtensionRewriter rw)
Rewrite the AST for the compilation in this language.
|
Term |
firstChild()
Return the first direct subterm performed when evaluating this term.
|
Flags |
flags()
Return the access flags of the variable, or Flags.NONE
|
Id |
id()
Return the name of the variable.
|
Local |
id(Id name)
Set the name of the local variable.
|
protected <N extends Local_c> |
id(N n,
Id name) |
boolean |
isConstant(Lang lang)
Return whether the expression evaluates to a constant.
|
LocalInstance |
localInstance()
Get the type object for the local.
|
Local |
localInstance(LocalInstance li)
Set the type object for the local.
|
protected <N extends Local_c> |
localInstance(N n,
LocalInstance li) |
java.lang.String |
name()
Return the name of the variable.
|
Local |
name(java.lang.String name)
Set the name of the local variable.
|
Precedence |
precedence()
Get the precedence of the expression.
|
void |
prettyPrint(CodeWriter w,
PrettyPrinter tr)
Pretty-print the AST using the given
CodeWriter . |
protected <N extends Local_c> |
reconstruct(N n,
Id name)
Reconstruct the expression.
|
java.lang.String |
toString() |
Node |
typeCheck(TypeChecker tc)
Type check the AST.
|
VarInstance |
varInstance()
Return the type object for the variable.
|
Node |
visitChildren(NodeVisitor v)
Visit the children of the node.
|
booleanValue, byteValue, charValue, constantValue, constantValueSet, doubleValue, floatValue, intValue, isConstant, isTypeChecked, lastLang, longValue, printSubExpr, printSubExpr, shortValue, stringValue, type, type, type
exceptionCheck, exceptions, exceptions, exceptions, listChild, reachable, reachable, reachable
addDecls, buildTypesEnter, checkConstants, childExpectedType, copy, copy, copyIfNeeded, del, del, disambiguate, disambiguateEnter, disambiguateOverride, dump, dump, dump, dump, enterChildScope, enterScope, error, error, error, exceptionCheckEnter, ext, ext, ext, ext, extRewriteEnter, isDisambiguated, lang, position, position, position, prettyPrint, prettyPrint, prettyPrint, prettyPrint, print, printBlock, printSubStmt, throwTypes, translate, typeCheckEnter, typeCheckOverride, visit, visitChild, visitEdge, visitList
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
constantValue, constantValueSet, isConstant, printSubExpr, printSubExpr, type
del, del, error, error, ext, ext, ext, ext, isDisambiguated, isTypeChecked, position, position, visit, visitEdge
addDecls, buildTypesEnter, checkConstants, childExpectedType, copy, disambiguate, disambiguateEnter, disambiguateOverride, dump, dump, dump, dump, enterChildScope, enterScope, exceptionCheck, exceptionCheckEnter, extRewriteEnter, lang, prettyPrint, prettyPrint, prettyPrint, prettyPrint, throwTypes, translate, typeCheckEnter, typeCheckOverride, visitChild, visitList
exceptions, exceptions, reachable, reachable
protected Id name
protected LocalInstance li
public Precedence precedence()
Expr
precedence
in interface Expr
precedence
in class Expr_c
public Id id()
NamedVariable
id
in interface NamedVariable
public Local id(Id name)
Local
public java.lang.String name()
NamedVariable
name
in interface NamedVariable
public Local name(java.lang.String name)
Local
public Flags flags()
NamedVariable
flags
in interface NamedVariable
flags
in interface Variable
public VarInstance varInstance()
NamedVariable
varInstance
in interface NamedVariable
public LocalInstance localInstance()
Local
localInstance
in interface Local
public Local localInstance(LocalInstance li)
Local
localInstance
in interface Local
protected <N extends Local_c> N localInstance(N n, LocalInstance li)
public Node visitChildren(NodeVisitor v)
NodeOps
visitChildren
in interface NodeOps
visitChildren
in class Node_c
v
- The visitor that will traverse/rewrite the AST.this
.public Node buildTypes(TypeBuilder tb) throws SemanticException
NodeOps
TypeSystem
.
This method is called by the leave()
method of the
visitor. The method should perform work that should be done
after visiting the children of the node. The method may return
this
or a new copy of the node which will be
installed as a child of the node's parent.buildTypes
in interface NodeOps
buildTypes
in class Expr_c
tb
- The visitor which adds new type objects to the
TypeSystem
.SemanticException
public Node typeCheck(TypeChecker tc) throws SemanticException
NodeOps
leave()
method of the
visitor. The method should perform work that should be done
after visiting the children of the node. The method may return
this
or a new copy of the node which will be
installed as a child of the node's parent.typeCheck
in interface NodeOps
typeCheck
in class Node_c
tc
- The type checking visitor.SemanticException
public Node extRewrite(ExtensionRewriter rw) throws SemanticException
NodeOps
leave()
method of the
visitor. The method should perform work that should be done
after visiting the children of the node. The method may return
this
or a new copy of the node which will be
installed as a child of the node's parent.extRewrite
in interface NodeOps
extRewrite
in class Expr_c
rw
- The visitor.SemanticException
public Term firstChild()
TermOps
firstChild
in interface TermOps
firstChild
in class Term_c
public <T> java.util.List<T> acceptCFG(CFGBuilder<?> v, java.util.List<T> succs)
TermOps
public void prettyPrint(CodeWriter w, PrettyPrinter tr)
Node_c
CodeWriter
.prettyPrint
in interface NodeOps
prettyPrint
in class Node_c
w
- The code writer to which to write.tr
- The pretty printer. This is not a visitor.public void dump(CodeWriter w)
Node
public boolean constantValueSet(Lang lang)
ExprOps
isConstant()
is valid only if
constantValueSet()
is true.constantValueSet
in interface ExprOps
constantValueSet
in class Expr_c
public boolean isConstant(Lang lang)
ExprOps
constantValueSet()
is true.isConstant
in interface ExprOps
isConstant
in class Expr_c
public java.lang.Object constantValue(Lang lang)
ExprOps
isConstant()
is true.constantValue
in interface ExprOps
constantValue
in class Expr_c