polyglot.ast
Class AmbExpr_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.AmbExpr_c
All Implemented Interfaces:
java.lang.Cloneable, AmbExpr, Ambiguous, Expr, JL, Node, NodeOps, Prefix, Receiver, Term, Typed, Copy

public class AmbExpr_c
extends Expr_c
implements AmbExpr

An AmbExpr is an ambiguous AST node composed of a single identifier that must resolve to an expression.


Field Summary
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
AmbExpr_c(Position pos, Id name)
           
 
Method Summary
 java.util.List acceptCFG(CFGBuilder v, java.util.List succs)
          Visit this term in evaluation order.
 Node copy(NodeFactory nf)
          Produce a copy of this node using the given NodeFactory.
 Node disambiguate(AmbiguityRemover ar)
          Disambiguate the expression.
 Node exceptionCheck(ExceptionChecker ec)
          Check exceptions thrown by the expression.
 Term firstChild()
          Return the first (sub)term performed when evaluating this term.
 Id id()
          Get the name of the expression.
 AmbExpr id(Id id)
          Set the name of the expression.
 java.lang.String name()
          Get the name of the expression.
 AmbExpr name(java.lang.String name)
          Set the name of the expression.
 Precedence precedence()
          Get the precedence of the field.
 void prettyPrint(CodeWriter w, PrettyPrinter tr)
          Write the expression to an output file.
protected  AmbExpr_c reconstruct(Id name)
          Reconstruct the expression.
 java.lang.String toString()
           
 Node typeCheck(TypeChecker tc)
          Type check the AST.
 Node visitChildren(NodeVisitor v)
          Visit the children of the constructor.
 
Methods inherited from class polyglot.ast.Expr_c
booleanValue, buildTypes, byteValue, charValue, constantValue, constantValueSet, doubleValue, dump, floatValue, intValue, isConstant, isTypeChecked, longValue, printSubExpr, printSubExpr, shortValue, stringValue, type, type
 
Methods inherited from class polyglot.ast.Term_c
exceptions, exceptions, listChild, reachable, reachable
 
Methods inherited from class polyglot.ast.Node_c
addDecls, buildTypesEnter, checkConstants, childExpectedType, copy, copy, del, del, 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
constantValue, constantValueSet, isConstant, printSubExpr, printSubExpr, type
 
Methods inherited from interface polyglot.ast.Node
childExpectedType, del, del, dump, 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, buildTypes, buildTypesEnter, checkConstants, copy, disambiguateEnter, disambiguateOverride, dump, dump, enterChildScope, enterScope, 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
Constructor Detail

AmbExpr_c

public AmbExpr_c(Position pos,
                 Id name)
Method Detail

precedence

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

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

id

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

Specified by:
id in interface AmbExpr

id

public AmbExpr id(Id id)
Set the name of the expression.

Specified by:
id in interface AmbExpr

name

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

Specified by:
name in interface AmbExpr

name

public AmbExpr name(java.lang.String name)
Set the name of the expression.

Specified by:
name in interface AmbExpr

reconstruct

protected AmbExpr_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.

disambiguate

public Node disambiguate(AmbiguityRemover ar)
                  throws SemanticException
Disambiguate the expression.

Specified by:
disambiguate in interface NodeOps
Overrides:
disambiguate in class Node_c
Parameters:
ar - The visitor which disambiguates.
Throws:
SemanticException

typeCheck

public Node typeCheck(TypeChecker tc)
               throws SemanticException
Description copied from interface: NodeOps
Type check the AST. 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:
typeCheck in interface NodeOps
Overrides:
typeCheck in class Node_c
Parameters:
tc - The type checking visitor.
Throws:
SemanticException

exceptionCheck

public Node exceptionCheck(ExceptionChecker ec)
                    throws SemanticException
Check exceptions thrown by the expression.

Specified by:
exceptionCheck in interface NodeOps
Overrides:
exceptionCheck in class Term_c
Parameters:
ec - The visitor.
Throws:
SemanticException

prettyPrint

public void prettyPrint(CodeWriter w,
                        PrettyPrinter tr)
Write the expression 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.

toString

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

firstChild

public Term firstChild()
Return the first (sub)term performed when evaluating this term.

Specified by:
firstChild in interface Term

acceptCFG

public java.util.List acceptCFG(CFGBuilder v,
                                java.util.List succs)
Visit this term in evaluation order.

Specified by:
acceptCFG in interface Term
Specified by:
acceptCFG in class Term_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