|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectpolyglot.ext.jl.ast.Node_c
polyglot.ext.jl.ast.Term_c
polyglot.ext.jl.ast.Initializer_c
An Initializer is an immutable representation of an
initializer block in a Java class (which appears outside of any
method). Such a block is executed before the code for any of the
constructors. Such a block can optionally be static, in which case
it is executed when the class is loaded.
| Field Summary | |
protected Block |
body
|
protected Flags |
flags
|
protected InitializerInstance |
ii
|
| Fields inherited from class polyglot.ext.jl.ast.Term_c |
exceptions, reachable |
| Fields inherited from class polyglot.ext.jl.ast.Node_c |
del, ext, position |
| Constructor Summary | |
Initializer_c(Position pos,
Flags flags,
Block body)
|
|
| Method Summary | |
java.util.List |
acceptCFG(CFGBuilder v,
java.util.List succs)
Visit this node, calling calling v.edge() for each successor in succs, if data flows on that edge. |
NodeVisitor |
addMembersEnter(AddMemberVisitor am)
Adds disambiguated methods and fields to the types. |
Block |
body()
Get the body of the initializer. |
CodeDecl |
body(Block body)
Set the body of the initializer. |
Node |
buildTypes(TypeBuilder tb)
Build type objects for the method. |
NodeVisitor |
buildTypesEnter(TypeBuilder tb)
Collects classes, methods, and fields from the AST rooted at this node and constructs type objects for these. |
CodeInstance |
codeInstance()
The CodeInstance of the method, constructor, or initializer. |
NodeVisitor |
disambiguateEnter(AmbiguityRemover ar)
Remove any remaining ambiguities from the AST. |
void |
dump(CodeWriter w)
Dump the AST node for debugging purposes. |
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. |
Term |
entry()
Return the first (sub)term performed when evaluating this term. |
Node |
exceptionCheck(ExceptionChecker ec)
Check exceptions thrown by the initializer. |
Flags |
flags()
Get the flags of the initializer. |
Initializer |
flags(Flags flags)
Set the flags of the initializer. |
InitializerInstance |
initializerInstance()
Get the initializer instance of the initializer. |
Initializer |
initializerInstance(InitializerInstance ii)
Set the initializer instance of the initializer. |
void |
prettyPrint(CodeWriter w,
PrettyPrinter tr)
Write the initializer to an output file. |
protected Initializer_c |
reconstruct(Block body)
Reconstruct the initializer. |
java.lang.String |
toString()
|
Node |
typeCheck(TypeChecker tc)
Type check the initializer. |
Node |
visitChildren(NodeVisitor v)
Visit the children of the initializer. |
| Methods inherited from class polyglot.ext.jl.ast.Term_c |
exceptions, exceptions, listEntry, reachable, reachable |
| Methods inherited from class polyglot.ext.jl.ast.Node_c |
addDecls, addMembers, addMembersOverride, buildTypesOverride, childExpectedType, copy, del, del, disambiguate, disambiguateOverride, enterScope, exceptionCheckEnter, exceptionCheckOverride, ext, ext, ext, ext, init, node, position, position, print, printBlock, printSubStmt, throwTypes, translate, typeCheckEnter, typeCheckOverride, visit, visitChild, visitEdge, visitList |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface polyglot.ast.Term |
exceptions, exceptions, reachable, reachable |
| Methods inherited from interface polyglot.ast.Node |
childExpectedType, del, del, ext, ext, ext, ext, position, position, visit, visitChild, visitEdge, visitList |
| Methods inherited from interface polyglot.ast.JL |
init, node |
| Methods inherited from interface polyglot.ast.NodeOps |
addDecls, addMembers, disambiguate, enterScope, exceptionCheckEnter, throwTypes, translate, typeCheckEnter |
| Methods inherited from interface polyglot.util.Copy |
copy |
| Field Detail |
protected Flags flags
protected Block body
protected InitializerInstance ii
| Constructor Detail |
public Initializer_c(Position pos,
Flags flags,
Block body)
| Method Detail |
public Flags flags()
flags in interface Initializerpublic Initializer flags(Flags flags)
flags in interface Initializerpublic InitializerInstance initializerInstance()
initializerInstance in interface Initializerpublic CodeInstance codeInstance()
CodeDecl
codeInstance in interface CodeDeclpublic Initializer initializerInstance(InitializerInstance ii)
initializerInstance in interface Initializerpublic Block body()
body in interface CodeDeclpublic CodeDecl body(Block body)
body in interface CodeDeclprotected Initializer_c reconstruct(Block body)
public Node visitChildren(NodeVisitor v)
visitChildren in interface NodeOpsvisitChildren in class Node_cpublic Context enterScope(Context c)
NodeOpsaddDecls when leaving the node
for that.
enterScope in interface NodeOpsenterScope in class Node_cc - the current Context
Context to be used for visiting this node.
public NodeVisitor buildTypesEnter(TypeBuilder tb)
throws SemanticException
NodeOpsTypeSystem.
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.
buildTypesEnter in interface NodeOpsbuildTypesEnter in class Node_cSemanticExceptionpublic Term entry()
entry in interface Termentry in class Term_c
public java.util.List acceptCFG(CFGBuilder v,
java.util.List succs)
Term
acceptCFG in interface TermacceptCFG in class Term_c
public Node buildTypes(TypeBuilder tb)
throws SemanticException
buildTypes in interface NodeOpsbuildTypes in class Node_cSemanticExceptionpublic NodeVisitor addMembersEnter(AddMemberVisitor am)
NodeOpsenter() 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.
addMembersEnter in interface NodeOpsaddMembersEnter in class Node_c
public NodeVisitor disambiguateEnter(AmbiguityRemover ar)
throws SemanticException
NodeOpsenter() 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.
disambiguateEnter in interface NodeOpsdisambiguateEnter in class Node_cSemanticException
public Node typeCheck(TypeChecker tc)
throws SemanticException
typeCheck in interface NodeOpstypeCheck in class Node_cSemanticException
public Node exceptionCheck(ExceptionChecker ec)
throws SemanticException
exceptionCheck in interface NodeOpsexceptionCheck in class Term_cSemanticException
public void prettyPrint(CodeWriter w,
PrettyPrinter tr)
prettyPrint in interface NodeOpsprettyPrint in class Node_cpublic void dump(CodeWriter w)
Node
dump in interface Nodedump in class Node_cpublic java.lang.String toString()
toString in class Node_c
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||