|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpolyglot.ast.Node_c
polyglot.ast.Term_c
polyglot.ast.Initializer_c
public class 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.ast.Term_c |
---|
exceptions, reachable |
Fields inherited from class polyglot.ast.Node_c |
---|
del, error, ext, position |
Fields inherited from interface polyglot.ast.Term |
---|
ENTRY, EXIT |
Constructor Summary | |
---|---|
Initializer_c(Position pos,
Flags flags,
Block body)
|
Method Summary | |
---|---|
java.util.List |
acceptCFG(CFGBuilder v,
java.util.List succs)
Visit this term in evaluation order. |
Block |
body()
Get the body of the initializer. |
CodeBlock |
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. |
Term |
codeBody()
The body of the method, constructor, initializer, or field initializer. |
CodeInstance |
codeInstance()
The CodeInstance of the method, constructor, or initializer. |
Node |
copy(NodeFactory nf)
Produce a copy of this node using the given NodeFactory. |
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. |
NodeVisitor |
exceptionCheckEnter(ExceptionChecker ec)
Check that exceptions are properly propagated throughout the AST. |
Term |
firstChild()
Return the first (sub)term performed when evaluating this term. |
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. |
boolean |
isDisambiguated()
|
MemberInstance |
memberInstance()
|
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.ast.Term_c |
---|
exceptionCheck, exceptions, exceptions, listChild, reachable, reachable |
Methods inherited from class polyglot.ast.Node_c |
---|
addDecls, checkConstants, childExpectedType, copy, copy, del, del, disambiguate, disambiguateEnter, disambiguateOverride, dump, dump, enterChildScope, error, error, ext, ext, ext, ext, init, isTypeChecked, node, position, position, prettyPrint, prettyPrint, 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, error, error, ext, ext, ext, ext, isTypeChecked, position, position, visit, visitChild, visitEdge, visitList |
Methods inherited from interface polyglot.ast.JL |
---|
init, node |
Methods inherited from interface polyglot.ast.NodeOps |
---|
addDecls, checkConstants, copy, disambiguate, disambiguateEnter, disambiguateOverride, dump, dump, enterChildScope, exceptionCheck, prettyPrint, prettyPrint, throwTypes, translate, typeCheckEnter, typeCheckOverride |
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 boolean isDisambiguated()
isDisambiguated
in interface Node
isDisambiguated
in class Node_c
public MemberInstance memberInstance()
memberInstance
in interface ClassMember
public Flags flags()
flags
in interface Initializer
public Initializer flags(Flags flags)
flags
in interface Initializer
public InitializerInstance initializerInstance()
initializerInstance
in interface Initializer
public CodeInstance codeInstance()
CodeNode
codeInstance
in interface CodeNode
public Initializer initializerInstance(InitializerInstance ii)
initializerInstance
in interface Initializer
public Term codeBody()
CodeNode
codeBody
in interface CodeNode
public Block body()
body
in interface CodeBlock
public CodeBlock body(Block body)
body
in interface CodeBlock
protected Initializer_c reconstruct(Block body)
public Node visitChildren(NodeVisitor v)
visitChildren
in interface NodeOps
visitChildren
in class Node_c
v
- The visitor that will traverse/rewrite the AST.
this
.public Context enterScope(Context c)
Node_c
enterScope
in interface NodeOps
enterScope
in class Node_c
c
- the current Context
Context
to be used for visiting this node.public NodeVisitor buildTypesEnter(TypeBuilder tb) throws SemanticException
NodeOps
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.
buildTypesEnter
in interface NodeOps
buildTypesEnter
in class Node_c
tb
- The visitor which adds new type objects to the
TypeSystem
.
SemanticException
public Term firstChild()
firstChild
in interface Term
public java.util.List acceptCFG(CFGBuilder v, java.util.List succs)
Term_c
acceptCFG
in interface Term
acceptCFG
in class Term_c
public Node buildTypes(TypeBuilder tb) throws SemanticException
buildTypes
in interface NodeOps
buildTypes
in class Node_c
tb
- The visitor which adds new type objects to the
TypeSystem
.
SemanticException
public Node typeCheck(TypeChecker tc) throws SemanticException
typeCheck
in interface NodeOps
typeCheck
in class Node_c
tc
- The type checking visitor.
SemanticException
public NodeVisitor exceptionCheckEnter(ExceptionChecker ec) throws SemanticException
NodeOps
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.
exceptionCheckEnter
in interface NodeOps
exceptionCheckEnter
in class Node_c
ec
- The visitor.
SemanticException
public void prettyPrint(CodeWriter w, PrettyPrinter tr)
prettyPrint
in interface NodeOps
prettyPrint
in class Node_c
w
- The code writer to which to write.tr
- The pretty printer. This is not a visitor.public void dump(CodeWriter w)
Node
dump
in interface Node
dump
in class Node_c
public java.lang.String toString()
toString
in class Node_c
public Node copy(NodeFactory nf)
NodeOps
copy
in interface NodeOps
copy
in class Node_c
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |