polyglot.ast
Class Local_c

java.lang.Object
  extended by polyglot.ast.Node_c
      extended by polyglot.ast.Term_c
          extended by polyglot.ast.Expr_c
              extended by polyglot.ast.Local_c
All Implemented Interfaces:
java.lang.Cloneable, Expr, JL, Local, NamedVariable, Node, NodeOps, Prefix, Receiver, Term, Typed, Variable, Copy

public class Local_c
extends Expr_c
implements Local

A local variable expression.


Field Summary
protected  LocalInstance li
           
protected  Id name
           
 
Fields inherited from class polyglot.ast.Expr_c
type
 
Fields inherited from class polyglot.ast.Term_c
exceptions, reachable
 
Fields inherited from class polyglot.ast.Node_c
del, error, ext, position
 
Fields inherited from interface polyglot.ast.Term
ENTRY, EXIT
 
Constructor Summary
Local_c(Position pos, Id name)
           
 
Method Summary
 java.util.List acceptCFG(CFGBuilder v, java.util.List succs)
          Visit this term in evaluation order.
 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()
          Returns the constant value of the expression, if any.
 boolean constantValueSet()
           
 Node copy(NodeFactory nf)
          Produce a copy of this node using the given NodeFactory.
 void dump(CodeWriter w)
          Dumps the AST.
 Term firstChild()
          Return the first direct subterm performed when evaluating this term.
 Flags flags()
          Return the access flags of the variable.
 Id id()
          Get the name of the local.
 Local id(Id name)
          Set the name of the local.
 boolean isConstant()
          Return whether the expression evaluates to a constant.
 LocalInstance localInstance()
          Get the local instance of the local.
 Local localInstance(LocalInstance li)
          Set the local instance of the local.
 java.lang.String name()
          Get the name of the local.
 Local name(java.lang.String name)
          Set the name of the local.
 Precedence precedence()
          Get the precedence of the local.
 void prettyPrint(CodeWriter w, PrettyPrinter tr)
          Write the local to an output file.
protected  Local_c reconstruct(Id name)
          Reconstruct the expression.
 java.lang.String toString()
           
 Node typeCheck(TypeChecker tc)
          Type check the local.
 VarInstance varInstance()
          Get the local instance of the local.
 Node visitChildren(NodeVisitor v)
          Visit the children of the constructor.
 
Methods inherited from class polyglot.ast.Expr_c
booleanValue, byteValue, charValue, doubleValue, floatValue, intValue, isTypeChecked, longValue, printSubExpr, printSubExpr, shortValue, stringValue, type, type
 
Methods inherited from class polyglot.ast.Term_c
exceptionCheck, exceptions, exceptions, listChild, reachable, reachable
 
Methods inherited from class polyglot.ast.Node_c
addDecls, buildTypesEnter, checkConstants, childExpectedType, copy, copy, del, del, disambiguate, disambiguateEnter, disambiguateOverride, dump, dump, enterChildScope, enterScope, error, error, exceptionCheckEnter, ext, ext, ext, ext, init, isDisambiguated, node, position, position, prettyPrint, prettyPrint, print, printBlock, printSubStmt, throwTypes, translate, typeCheckEnter, typeCheckOverride, visit, visitChild, visitEdge, visitList
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface polyglot.ast.Expr
printSubExpr, printSubExpr, type
 
Methods inherited from interface polyglot.ast.Node
childExpectedType, del, del, error, error, ext, ext, ext, ext, isDisambiguated, isTypeChecked, position, position, visit, visitChild, visitEdge, visitList
 
Methods inherited from interface polyglot.ast.JL
init, node
 
Methods inherited from interface polyglot.ast.NodeOps
addDecls, buildTypesEnter, checkConstants, copy, disambiguate, disambiguateEnter, disambiguateOverride, dump, dump, enterChildScope, enterScope, exceptionCheck, exceptionCheckEnter, prettyPrint, prettyPrint, throwTypes, translate, typeCheckEnter, typeCheckOverride
 
Methods inherited from interface polyglot.util.Copy
copy
 
Methods inherited from interface polyglot.ast.Typed
type
 
Methods inherited from interface polyglot.ast.Term
exceptions, exceptions, reachable, reachable
 

Field Detail

name

protected Id name

li

protected LocalInstance li
Constructor Detail

Local_c

public Local_c(Position pos,
               Id name)
Method Detail

precedence

public Precedence precedence()
Get the precedence of the local.

Specified by:
precedence in interface Expr
Overrides:
precedence in class Expr_c

id

public Id id()
Get the name of the local.

Specified by:
id in interface Local

id

public Local id(Id name)
Set the name of the local.

Specified by:
id in interface Local

name

public java.lang.String name()
Get the name of the local.

Specified by:
name in interface Local
Specified by:
name in interface NamedVariable

name

public Local name(java.lang.String name)
Set the name of the local.

Specified by:
name in interface Local

flags

public Flags flags()
Return the access flags of the variable.

Specified by:
flags in interface NamedVariable
Specified by:
flags in interface Variable

varInstance

public VarInstance varInstance()
Get the local instance of the local.

Specified by:
varInstance in interface NamedVariable

localInstance

public LocalInstance localInstance()
Get the local instance of the local.

Specified by:
localInstance in interface Local

localInstance

public Local localInstance(LocalInstance li)
Set the local instance of the local.

Specified by:
localInstance in interface Local

reconstruct

protected Local_c reconstruct(Id name)
Reconstruct the expression.


visitChildren

public Node visitChildren(NodeVisitor v)
Visit the children of the constructor.

Specified by:
visitChildren in interface NodeOps
Overrides:
visitChildren in class Node_c
Parameters:
v - The visitor that will traverse/rewrite the AST.
Returns:
A new AST if a change was made, or this.

buildTypes

public Node buildTypes(TypeBuilder tb)
                throws SemanticException
Description copied from interface: NodeOps
Collects classes, methods, and fields from the AST rooted at this node and constructs type objects for these. These type objects may be ambiguous. Inserts classes into the 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.

Specified by:
buildTypes in interface NodeOps
Overrides:
buildTypes in class Expr_c
Parameters:
tb - The visitor which adds new type objects to the TypeSystem.
Throws:
SemanticException

typeCheck

public Node typeCheck(TypeChecker tc)
               throws SemanticException
Type check the local.

Specified by:
typeCheck in interface NodeOps
Overrides:
typeCheck in class Node_c
Parameters:
tc - The type checking visitor.
Throws:
SemanticException

firstChild

public Term firstChild()
Description copied from interface: Term
Return the first direct subterm performed when evaluating this term. If this term has no subterms, this should return null. This method is similar to the deprecated entry(), but it should *not* recursively drill down to the innermost subterm. The direct child visited first in this term's dataflow should be returned.

Specified by:
firstChild in interface Term

acceptCFG

public java.util.List acceptCFG(CFGBuilder v,
                                java.util.List succs)
Description copied from class: Term_c
Visit this term in evaluation order.

Specified by:
acceptCFG in interface Term
Specified by:
acceptCFG in class Term_c

toString

public java.lang.String toString()
Overrides:
toString in class Node_c

prettyPrint

public void prettyPrint(CodeWriter w,
                        PrettyPrinter tr)
Write the local to an output file.

Specified by:
prettyPrint in interface NodeOps
Overrides:
prettyPrint in class Node_c
Parameters:
w - The code writer to which to write.
tr - The pretty printer. This is not a visitor.

dump

public void dump(CodeWriter w)
Dumps the AST.

Specified by:
dump in interface Node
Overrides:
dump in class Expr_c

constantValueSet

public boolean constantValueSet()
Specified by:
constantValueSet in interface Expr
Overrides:
constantValueSet in class Expr_c

isConstant

public boolean isConstant()
Description copied from interface: Expr
Return whether the expression evaluates to a constant. This is not valid until after disambiguation.

Specified by:
isConstant in interface Expr
Overrides:
isConstant in class Expr_c

constantValue

public java.lang.Object constantValue()
Description copied from interface: Expr
Returns the constant value of the expression, if any.

Specified by:
constantValue in interface Expr
Overrides:
constantValue in class Expr_c

copy

public Node copy(NodeFactory nf)
Description copied from interface: NodeOps
Produce a copy of this node using the given NodeFactory.

Specified by:
copy in interface NodeOps
Overrides:
copy in class Node_c