|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface NodeOps
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 | |
---|---|
void |
addDecls(Context c)
Add any declarations to the context that should be in scope when visiting later sibling nodes. |
Node |
addMembers(AddMemberVisitor am)
Adds disambiguated methods and fields to the types. |
NodeVisitor |
addMembersEnter(AddMemberVisitor am)
Adds disambiguated methods and fields to the types. |
Node |
buildTypes(TypeBuilder tb)
Collects classes, methods, and fields from the AST rooted at this node and constructs type objects for these. |
NodeVisitor |
buildTypesEnter(TypeBuilder tb)
Collects classes, methods, and fields from the AST rooted at this node and constructs type objects for these. |
Node |
disambiguate(AmbiguityRemover ar)
Remove any remaining ambiguities from the AST. |
NodeVisitor |
disambiguateEnter(AmbiguityRemover ar)
Remove any remaining ambiguities from the AST. |
Context |
enterScope(Context c)
Push a new scope upon entering this node, and add any declarations to the context that should be in scope when visiting children of this node. |
Context |
enterScope(Node child,
Context c)
Push a new scope for visiting the child node child . |
Node |
exceptionCheck(ExceptionChecker ec)
Check that exceptions are properly propagated throughout the AST. |
NodeVisitor |
exceptionCheckEnter(ExceptionChecker ec)
Check that exceptions are properly propagated throughout the AST. |
void |
prettyPrint(CodeWriter w,
PrettyPrinter pp)
Pretty-print the AST using the given code writer. |
java.util.List |
throwTypes(TypeSystem ts)
List of Types of exceptions that might get thrown. |
void |
translate(CodeWriter w,
Translator tr)
Translate the AST using the given code writer. |
Node |
typeCheck(TypeChecker tc)
Type check the AST. |
NodeVisitor |
typeCheckEnter(TypeChecker tc)
Type check the AST. |
Node |
visitChildren(NodeVisitor v)
Visit the children of the node. |
Method Detail |
---|
Node visitChildren(NodeVisitor v)
v
- The visitor that will traverse/rewrite the AST.
this
.Context enterScope(Context c)
addDecls
when leaving the node
for that.
c
- the current Context
Context
to be used for visiting this node.Context enterScope(Node child, Context c)
child
.
The default behavior is to delegate the call to the child node, and let
it add appropriate declarations that should be in scope. However,
this method gives parent nodes have the ability to modify this behavior.
child
- the child node about to be entered.c
- the current Context
Context
to be used for visiting node
child
void addDecls(Context c)
c
- The context to which to add declarations.NodeVisitor buildTypesEnter(TypeBuilder tb) throws SemanticException
TypeSystem
.
This method is called by the enter()
method of the
visitor. The * method should perform work that should be done
before visiting the children of the node. The method may return
this
or a new copy of the node on which
visitChildren()
and leave()
will be
invoked.
tb
- The visitor which adds new type objects to the
TypeSystem
.
SemanticException
Node buildTypes(TypeBuilder tb) throws SemanticException
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.
tb
- The visitor which adds new type objects to the
TypeSystem
.
SemanticException
NodeVisitor disambiguateEnter(AmbiguityRemover ar) throws SemanticException
enter()
method of the
visitor. The * method should perform work that should be done
before visiting the children of the node. The method may return
this
or a new copy of the node on which
visitChildren()
and leave()
will be
invoked.
ar
- The visitor which disambiguates.
SemanticException
Node disambiguate(AmbiguityRemover ar) throws SemanticException
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.
ar
- The visitor which disambiguates.
SemanticException
NodeVisitor addMembersEnter(AddMemberVisitor am) throws SemanticException
enter()
method of the
visitor. The * method should perform work that should be done
before visiting the children of the node. The method may return
this
or a new copy of the node on which
visitChildren()
and leave()
will be
invoked.
am
- The visitor which builds types.
SemanticException
Node addMembers(AddMemberVisitor am) throws SemanticException
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.
am
- The visitor which builds types.
SemanticException
NodeVisitor typeCheckEnter(TypeChecker tc) throws SemanticException
enter()
method of the
visitor. The * method should perform work that should be done
before visiting the children of the node. The method may return
this
or a new copy of the node on which
visitChildren()
and leave()
will be
invoked.
tc
- The type checking visitor.
SemanticException
Node typeCheck(TypeChecker tc) throws SemanticException
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.
tc
- The type checking visitor.
SemanticException
NodeVisitor exceptionCheckEnter(ExceptionChecker ec) throws SemanticException
enter()
method of the
visitor. The * method should perform work that should be done
before visiting the children of the node. The method may return
this
or a new copy of the node on which
visitChildren()
and leave()
will be
invoked.
ec
- The visitor.
SemanticException
Node exceptionCheck(ExceptionChecker ec) throws SemanticException
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.
ec
- The visitor.
SemanticException
java.util.List throwTypes(TypeSystem ts)
void prettyPrint(CodeWriter w, PrettyPrinter pp)
w
- The code writer to which to write.pp
- The pretty printer. This is not a visitor.void translate(CodeWriter w, Translator tr)
w
- The code writer to which to write.tr
- The translation pass. This is not a visitor.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |