|
|||||||||
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
.
public Node visitChildren(NodeVisitor v)
public void enterScope(Context c)
public void leaveScope(Context c)
public Node reconstructTypes_(NodeFactory nf, TypeSystem ts, Context c) throws SemanticException
public Node buildTypesOverride_(TypeBuilder tb) throws SemanticException
cb
- The visitor which adds new type objects to the
TypeSystem
.public Node buildTypes_(TypeBuilder tb) throws SemanticException
public Node disambiguateTypesOverride_(TypeAmbiguityRemover sc) throws SemanticException
cb
- The visitor which builds contexts.public Node disambiguateTypes_(TypeAmbiguityRemover sc) throws SemanticException
public Node disambiguateOverride_(AmbiguityRemover ar) throws SemanticException
ar
- The visitor which disambiguates.public Node disambiguate_(AmbiguityRemover ar) throws SemanticException
public Node foldConstantsOverride_(ConstantFolder cf)
cf
- The constant folding visitor.public Node foldConstants_(ConstantFolder cf)
public Node typeCheckOverride_(TypeChecker tc) throws SemanticException
tc
- The type checking visitor.public Node typeCheck_(TypeChecker tc) throws SemanticException
public Node exceptionCheckOverride_(ExceptionChecker ec) throws SemanticException
ec
- The visitor.public Node exceptionCheck_(ExceptionChecker ec) throws SemanticException
public void translate_(CodeWriter w, Translator tr)
w
- The code writer to which to write.tr
- The translation pass. This is not a visitor.public void dump(CodeWriter w)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |