|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--jltools.ext.jl.ast.Node_c
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.
Inner Class Summary | |
class |
Node_c.StringCodeWriter
|
Field Summary | |
protected Ext |
ext
|
protected Position |
position
|
Constructor Summary | |
Node_c(Ext ext,
Position pos)
|
Method Summary | |
Node |
buildTypes_(TypeBuilder tb)
|
void |
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. |
void |
buildTypesOverride(TypeBuilder tb)
|
java.lang.Object |
copy()
Clone the node. |
Node |
disambiguate_(AmbiguityRemover ar)
|
void |
disambiguate(AmbiguityRemover ar)
|
Node |
disambiguateOverride_(AmbiguityRemover ar)
Remove any remaining ambiguities from the AST. |
void |
disambiguateOverride(AmbiguityRemover ar)
|
Node |
disambiguateTypes_(TypeAmbiguityRemover sc)
|
void |
disambiguateTypes(TypeAmbiguityRemover sc)
|
Node |
disambiguateTypesOverride_(TypeAmbiguityRemover sc)
Clean type signatures. |
void |
disambiguateTypesOverride(TypeAmbiguityRemover sc)
|
void |
dump(CodeWriter w)
Dump the AST node for debugging purposes. |
void |
enterScope(Context c)
Adjust the environment for entering a new scope. |
Node |
exceptionCheck_(ExceptionChecker ec)
|
void |
exceptionCheck(ExceptionChecker ec)
|
Node |
exceptionCheckOverride_(ExceptionChecker ec)
Check that exceptions are properly propagated throughout the AST. |
void |
exceptionCheckOverride(ExceptionChecker ec)
|
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)
|
void |
foldConstants(ConstantFolder cf)
|
Node |
foldConstantsOverride_(ConstantFolder cf)
Fold all constants. |
void |
foldConstantsOverride(ConstantFolder cf)
|
void |
leaveScope(Context c)
Adjust the environment for leaving the current scope. |
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 |
reconstructTypes(NodeFactory nf,
TypeSystem ts,
Context c)
|
java.lang.String |
toString()
|
void |
translate_(CodeWriter w,
Translator tr)
Translate the AST using the given CodeWriter . |
void |
translate(CodeWriter w,
Translator tr)
|
void |
translateBlock(Node n,
CodeWriter w,
Translator tr)
|
void |
translateSubstmt(Stmt stmt,
CodeWriter w,
Translator tr)
|
Node |
typeCheck_(TypeChecker tc)
|
void |
typeCheck(TypeChecker tc)
|
Node |
typeCheckOverride_(TypeChecker tc)
Type check the AST. |
void |
typeCheckOverride(TypeChecker tc)
|
Node |
visit(NodeVisitor v)
Visit the node. |
Node |
visitChildren(NodeVisitor v)
Visit the children of the node. |
static java.util.List |
visitList(java.util.List l,
NodeVisitor v)
Visit all the elements of a list. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected Ext ext
protected Position position
Constructor Detail |
public Node_c(Ext ext, Position pos)
Method Detail |
public java.lang.Object copy()
Node
copy
in interface Node
public Ext ext()
Node
n.delegate().typeCheck(c)rather than:
n.typeCheck_(c)
ext
in interface Node
public Node ext(Ext ext)
Node
ext
in interface Node
public Position position()
Node
position
in interface Node
public Node position(Position position)
Node
position
in interface Node
public Node visit(NodeVisitor v)
Node
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.
- Specified by:
visit
in interface Node
- Following copied from interface:
jltools.ast.Node
- Parameters:
v
- The visitor which will traverse/rewrite the AST.- Returns:
- A new AST if a change was made, or
this
.
public static 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.public Node visitChildren(NodeVisitor v)
Node
visitChildren
in interface Node
public void enterScope(Context c)
enterScope
in interface Node
public void leaveScope(Context c)
leaveScope
in interface Node
public Node reconstructTypes_(NodeFactory nf, TypeSystem ts, Context c) throws SemanticException
reconstructTypes_
in interface Node
public Node buildTypesOverride_(TypeBuilder tb) throws SemanticException
Node
buildTypesOverride_
in interface Node
jltools.ast.Node
cb
- The visitor which adds new type objects to the
TypeSystem
.public Node buildTypes_(TypeBuilder tb) throws SemanticException
buildTypes_
in interface Node
public Node disambiguateTypesOverride_(TypeAmbiguityRemover sc) throws SemanticException
disambiguateTypesOverride_
in interface Node
jltools.ast.Node
cb
- The visitor which builds contexts.public Node disambiguateTypes_(TypeAmbiguityRemover sc) throws SemanticException
disambiguateTypes_
in interface Node
public Node disambiguateOverride_(AmbiguityRemover ar) throws SemanticException
disambiguateOverride_
in interface Node
jltools.ast.Node
ar
- The visitor which disambiguates.public Node disambiguate_(AmbiguityRemover ar) throws SemanticException
disambiguate_
in interface Node
public Node foldConstantsOverride_(ConstantFolder cf)
foldConstantsOverride_
in interface Node
jltools.ast.Node
cf
- The constant folding visitor.public Node foldConstants_(ConstantFolder cf)
foldConstants_
in interface Node
public Node typeCheckOverride_(TypeChecker tc) throws SemanticException
typeCheckOverride_
in interface Node
jltools.ast.Node
tc
- The type checking visitor.public Node typeCheck_(TypeChecker tc) throws SemanticException
typeCheck_
in interface Node
public Node exceptionCheckOverride_(ExceptionChecker ec) throws SemanticException
exceptionCheckOverride_
in interface Node
jltools.ast.Node
ec
- The visitor.public Node exceptionCheck_(ExceptionChecker ec) throws SemanticException
exceptionCheck_
in interface Node
public void translate_(CodeWriter w, Translator tr)
CodeWriter
.translate_
in interface Node
jltools.ast.Node
w
- The code writer to which to write.tr
- The translation pass. This is not a visitor.public void translateBlock(Node n, CodeWriter w, Translator tr)
public void translateSubstmt(Stmt stmt, CodeWriter w, Translator tr)
public void dump(CodeWriter w)
Node
dump
in interface Node
public java.lang.String toString()
toString
in class java.lang.Object
public final void buildTypesOverride(TypeBuilder tb)
public final void buildTypes(TypeBuilder tb)
public final void disambiguateTypesOverride(TypeAmbiguityRemover sc)
public final void disambiguateTypes(TypeAmbiguityRemover sc)
public final void disambiguateOverride(AmbiguityRemover ar)
public final void disambiguate(AmbiguityRemover ar)
public final void foldConstantsOverride(ConstantFolder cf)
public final void foldConstants(ConstantFolder cf)
public final void typeCheckOverride(TypeChecker tc)
public final void typeCheck(TypeChecker tc)
public final void exceptionCheckOverride(ExceptionChecker ec)
public final void exceptionCheck(ExceptionChecker ec)
public final void translate(CodeWriter w, Translator tr)
public final void reconstructTypes(NodeFactory nf, TypeSystem ts, Context c)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |