|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Node
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 | |
---|---|
Type |
childExpectedType(Expr child,
AscriptionVisitor av)
Get the expected type of a child expression of this . |
JL |
del()
Get the node's delegate. |
Node |
del(JL del)
Set the delegate of the node. |
void |
dump(CodeWriter w)
Dump the AST node for debugging purposes. |
Ext |
ext()
Get the node's extension. |
Node |
ext(Ext ext)
Set the extension of the node. |
Ext |
ext(int n)
Get the node's nth extension, n >= 1. |
Node |
ext(int n,
Ext ext)
Set the node's nth extension, n >= 1. |
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 |
visit(NodeVisitor v)
Visit the node. |
Node |
visitChild(Node child,
NodeVisitor v)
Visit a single child of the node. |
Node |
visitEdge(Node parent,
NodeVisitor v)
Visit the node, passing in the node's parent. |
java.util.List |
visitList(java.util.List l,
NodeVisitor v)
Visit all the elements of a list. |
Methods inherited from interface polyglot.ast.JL |
---|
init, node |
Methods inherited from interface polyglot.ast.NodeOps |
---|
addDecls, addMembers, addMembersEnter, buildTypes, buildTypesEnter, disambiguate, disambiguateEnter, enterScope, enterScope, exceptionCheck, exceptionCheckEnter, prettyPrint, throwTypes, translate, typeCheck, typeCheckEnter, visitChildren |
Methods inherited from interface polyglot.util.Copy |
---|
copy |
Method Detail |
---|
Node del(JL del)
JL del()
Node ext(Ext ext)
Ext ext()
Node ext(int n, Ext ext)
Ext ext(int n)
Position position()
Node position(Position position)
Node visit(NodeVisitor v)
visitEdge(null, v)
.
v
- The visitor which will traverse/rewrite the AST.
this
.Node visitEdge(Node parent, 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:
parent
- The parent of this
in the AST.v
- The visitor which will traverse/rewrite the AST.
- Returns:
- A new AST if a change was made, or
this
.
Node visitChild(Node child, NodeVisitor v)
v
- The visitor which will traverse/rewrite the AST.child
- The child to visit.
child.visit(v)
, or null
if child
was null
.java.util.List visitList(java.util.List l, NodeVisitor v)
l
- The list to visit.v
- The visitor to use.
l
is a TypedList
, the
new list will also be typed with the same type as
l
. If l
is null
,
null
is returned.Type childExpectedType(Expr child, AscriptionVisitor av)
this
.
The expected type is determined by the context in that the child occurs
(e.g., for x = e
, the expected type of e
is
the declared type of x
.
The expected type should impose the least constraints on the child's
type that are allowed by the parent node.
child
- A child expression of this node.av
- An ascription visitor.
child
.void dump(CodeWriter w)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |