|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A Node
represents an AST node. All AST nodes must implement
this interface. Nodes should be immutable: methods which set fields
of the node should copy the node, set the field in the copy, and then
return the copy.
Method Summary | |
Node |
buildTypes_(TypeBuilder tb)
|
Node |
buildTypesOverride_(TypeBuilder tb)
Collects classes, methods, and fields from the AST rooted at this node and constructs type objects for these. |
java.lang.Object |
copy()
Clone the node. |
Node |
disambiguate_(AmbiguityRemover ar)
|
Node |
disambiguateOverride_(AmbiguityRemover ar)
Remove any remaining ambiguities from the AST. |
Node |
disambiguateTypes_(TypeAmbiguityRemover sc)
|
Node |
disambiguateTypesOverride_(TypeAmbiguityRemover sc)
Constructs a context for each type declared in the AST. |
void |
dump(CodeWriter w)
Dump the AST node for debugging purposes. |
void |
enterScope(Context c)
Adjust the environment on entering the scope of the method. |
Node |
exceptionCheck_(ExceptionChecker ec)
|
Node |
exceptionCheckOverride_(ExceptionChecker ec)
Check that exceptions are properly propagated throughout the AST. |
Ext |
ext()
Return the delegate for this node. |
Node |
ext(Ext ext)
Create a copy of the node with a new delegate. |
Node |
foldConstants_(ConstantFolder cf)
|
Node |
foldConstantsOverride_(ConstantFolder cf)
Fold constants in the AST. |
void |
leaveScope(Context c)
Adjust the environment on leaving the scope of the method. |
Position |
position()
Get the position of the node in the source file. |
Node |
position(Position position)
Create a copy of the node with a new position. |
Node |
reconstructTypes_(NodeFactory nf,
TypeSystem ts,
Context c)
This method can be called after a node is visited to ensure its type information is reconstructed. |
void |
translate_(CodeWriter w,
Translator tr)
Translate the AST using the given code writer. |
Node |
typeCheck_(TypeChecker tc)
|
Node |
typeCheckOverride_(TypeChecker tc)
Type check the AST. |
Node |
visit(NodeVisitor v)
Visit the node. |
Node |
visitChildren(NodeVisitor v)
Visit the children of the node. |
Method Detail |
public Ext ext()
n.delegate().typeCheck(c)rather than:
n.typeCheck_(c)
public Node ext(Ext ext)
public Position position()
public Node position(Position position)
public java.lang.Object copy()
copy
in interface Copy
public Node visit(NodeVisitor v)
NodeVisitor
to
traverse the AST starting at this node. This method should call the
override
, enter
, and leave methods
of the visitor. The method may return a new version of the node.
- Parameters:
v
- The visitor which will traverse/rewrite the AST.- Returns:
- A new AST if a change was made, or
this
.
visitChildren
public Node visitChildren(NodeVisitor v)
- Visit the children of the node.
enterScope
public void enterScope(Context c)
- Adjust the environment on entering the scope of the method.
leaveScope
public void leaveScope(Context c)
- Adjust the environment on leaving the scope of the method.
reconstructTypes_
public Node reconstructTypes_(NodeFactory nf,
TypeSystem ts,
Context c)
throws SemanticException
- This method can be called after a node is visited to ensure its
type information is reconstructed.
buildTypesOverride_
public Node buildTypesOverride_(TypeBuilder tb)
throws SemanticException
- Collects classes, methods, and fields from the AST rooted at this node
and constructs type objects for these. These type objects may be
ambiguous.
- Parameters:
cb
- The visitor which adds new type objects to the
TypeSystem
.
buildTypes_
public Node buildTypes_(TypeBuilder tb)
throws SemanticException
disambiguateTypesOverride_
public Node disambiguateTypesOverride_(TypeAmbiguityRemover sc)
throws SemanticException
- Constructs a context for each type declared in the AST.
A context is used to look up names when cleaning class signatures.
- Parameters:
cb
- The visitor which builds contexts.
disambiguateTypes_
public Node disambiguateTypes_(TypeAmbiguityRemover sc)
throws SemanticException
disambiguateOverride_
public Node disambiguateOverride_(AmbiguityRemover ar)
throws SemanticException
- Remove any remaining ambiguities from the AST.
- Parameters:
ar
- The visitor which disambiguates.
disambiguate_
public Node disambiguate_(AmbiguityRemover ar)
throws SemanticException
foldConstantsOverride_
public Node foldConstantsOverride_(ConstantFolder cf)
- Fold constants in the AST.
- Parameters:
cf
- The constant folding visitor.
foldConstants_
public Node foldConstants_(ConstantFolder cf)
typeCheckOverride_
public Node typeCheckOverride_(TypeChecker tc)
throws SemanticException
- Type check the AST.
- Parameters:
tc
- The type checking visitor.
typeCheck_
public Node typeCheck_(TypeChecker tc)
throws SemanticException
exceptionCheckOverride_
public Node exceptionCheckOverride_(ExceptionChecker ec)
throws SemanticException
- Check that exceptions are properly propagated throughout the AST.
- Parameters:
ec
- The visitor.
exceptionCheck_
public Node exceptionCheck_(ExceptionChecker ec)
throws SemanticException
translate_
public void translate_(CodeWriter w,
Translator tr)
- Translate the AST using the given code writer.
- Parameters:
w
- The code writer to which to write.tr
- The translation pass. This is not a visitor.
dump
public void dump(CodeWriter w)
- Dump the AST node for debugging purposes.
Overview
Package
Class
Tree
Deprecated
Index
Help
PREV CLASS
NEXT CLASS
FRAMES
NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD
DETAIL: FIELD | CONSTR | METHOD