polyglot.ast
Class TypeNode_c

java.lang.Object
  extended by polyglot.ast.Node_c
      extended by polyglot.ast.Term_c
          extended by polyglot.ast.TypeNode_c
All Implemented Interfaces:
java.lang.Cloneable, JL, Node, NodeOps, Prefix, QualifierNode, Receiver, Term, Typed, TypeNode, Copy
Direct Known Subclasses:
AmbTypeNode_c, ArrayTypeNode_c, CanonicalTypeNode_c

public abstract class TypeNode_c
extends Term_c
implements TypeNode

A TypeNode is the syntactic representation of a Type within the abstract syntax tree.


Field Summary
protected  Type 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
TypeNode_c(Position pos)
           
 
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.
 Term firstChild()
          Return the first direct subterm performed when evaluating this term.
 boolean isDisambiguated()
           
 java.lang.String name()
          Short name of the type, or null if not a Named type.
abstract  void prettyPrint(CodeWriter w, PrettyPrinter tr)
          Pretty-print the AST using the given CodeWriter.
 Qualifier qualifier()
          Get the type as a qualifier.
 java.lang.String toString()
           
 Type type()
          Get the type this node encapsulates.
 TypeNode type(Type type)
          Set the type this node encapsulates.
 
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, copy, del, del, disambiguate, disambiguateEnter, disambiguateOverride, dump, dump, dump, enterChildScope, enterScope, error, error, exceptionCheckEnter, ext, ext, ext, ext, init, isTypeChecked, node, position, position, prettyPrint, prettyPrint, print, printBlock, printSubStmt, throwTypes, translate, typeCheck, typeCheckEnter, typeCheckOverride, visit, visitChild, visitChildren, 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.Node
childExpectedType, del, del, dump, error, error, ext, ext, ext, ext, 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, copy, disambiguate, disambiguateEnter, disambiguateOverride, dump, dump, enterChildScope, enterScope, exceptionCheck, exceptionCheckEnter, prettyPrint, prettyPrint, throwTypes, translate, typeCheck, typeCheckEnter, typeCheckOverride, visitChildren
 
Methods inherited from interface polyglot.ast.Node
childExpectedType, del, del, dump, error, error, ext, ext, ext, ext, 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, copy, disambiguate, disambiguateEnter, disambiguateOverride, dump, dump, enterChildScope, enterScope, exceptionCheck, exceptionCheckEnter, prettyPrint, prettyPrint, throwTypes, translate, typeCheck, typeCheckEnter, typeCheckOverride, visitChildren
 
Methods inherited from interface polyglot.ast.Term
exceptions, exceptions, reachable, reachable
 

Field Detail

type

protected Type type
Constructor Detail

TypeNode_c

public TypeNode_c(Position pos)
Method Detail

isDisambiguated

public boolean isDisambiguated()
Specified by:
isDisambiguated in interface Node
Overrides:
isDisambiguated in class Node_c
Returns:
true if the all type information for the node (but not necessarily for the node's children) is unambiguous.

qualifier

public Qualifier qualifier()
Get the type as a qualifier.

Specified by:
qualifier in interface QualifierNode

type

public Type type()
Get the type this node encapsulates.

Specified by:
type in interface Typed

type

public TypeNode type(Type type)
Set the type this node encapsulates.

Specified by:
type in interface TypeNode

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 Node_c
Parameters:
tb - The visitor which adds new type objects to the TypeSystem.
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 abstract void prettyPrint(CodeWriter w,
                                 PrettyPrinter tr)
Description copied from class: Node_c
Pretty-print the AST using the given CodeWriter.

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.

name

public java.lang.String name()
Description copied from interface: TypeNode
Short name of the type, or null if not a Named type.

Specified by:
name in interface TypeNode