public class ClassBody_c extends Term_c implements ClassBody
ClassBody
represents the body of a class or interface
declaration or the body of an anonymous class.Term.Instance
Modifier and Type | Field and Description |
---|---|
protected java.util.List<ClassMember> |
members |
exceptions, reachable
Constructor and Description |
---|
ClassBody_c(Position pos,
java.util.List<ClassMember> members) |
ClassBody_c(Position pos,
java.util.List<ClassMember> members,
Ext ext) |
Modifier and Type | Method and Description |
---|---|
<T> java.util.List<T> |
acceptCFG(CFGBuilder<?> v,
java.util.List<T> succs)
Visit this term in evaluation order, calling v.edge() for each successor
in succs, if data flows on that edge.
|
ClassBody |
addMember(ClassMember member)
Add a member to the class, returning a new node.
|
NodeVisitor |
buildTypesEnter(TypeBuilder tb)
Collects classes, methods, and fields from the AST rooted at this node
and constructs type objects for these.
|
Node |
copy(NodeFactory nf)
Produce a copy of this node using the given NodeFactory.
|
Node |
disambiguate(AmbiguityRemover ar)
Remove any remaining ambiguities from the AST.
|
protected void |
duplicateConstructorCheck(TypeChecker tc) |
protected void |
duplicateFieldCheck(TypeChecker tc) |
protected void |
duplicateMemberClassCheck(TypeChecker tc) |
protected void |
duplicateMethodCheck(TypeChecker tc) |
NodeVisitor |
exceptionCheckEnter(ExceptionChecker ec)
Check that exceptions are properly propagated throughout the AST.
|
Term |
firstChild()
Return the first direct subterm performed when evaluating this term.
|
protected boolean |
isSameMethod(TypeSystem ts,
MethodInstance mi,
MethodInstance mj) |
java.util.List<ClassMember> |
members()
List of the class's members.
|
ClassBody |
members(java.util.List<ClassMember> members)
Set the class's members.
|
protected <N extends ClassBody_c> |
members(N n,
java.util.List<ClassMember> members) |
void |
prettyPrint(CodeWriter w,
PrettyPrinter tr)
Pretty-print the AST using the given
CodeWriter . |
protected <N extends ClassBody_c> |
reconstruct(N n,
java.util.List<ClassMember> members) |
java.lang.String |
toString() |
Node |
typeCheck(TypeChecker tc)
Type check the AST.
|
Node |
visitChildren(NodeVisitor v)
Visit the children of the node.
|
exceptionCheck, exceptions, exceptions, exceptions, extRewrite, listChild, reachable, reachable, reachable
addDecls, buildTypes, checkConstants, childExpectedType, copy, copy, copyIfNeeded, del, del, disambiguateEnter, disambiguateOverride, dump, dump, dump, dump, dump, enterChildScope, enterScope, error, error, error, ext, ext, ext, ext, extRewriteEnter, isDisambiguated, isTypeChecked, lang, position, position, position, prettyPrint, prettyPrint, prettyPrint, prettyPrint, print, printBlock, printSubStmt, throwTypes, translate, typeCheckEnter, typeCheckOverride, visit, visitChild, visitEdge, visitList
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
exceptions, exceptions, reachable, reachable
del, del, dump, error, error, ext, ext, ext, ext, isDisambiguated, isTypeChecked, position, position, visit, visitEdge
addDecls, buildTypes, checkConstants, childExpectedType, copy, disambiguateEnter, disambiguateOverride, dump, dump, dump, dump, enterChildScope, enterScope, exceptionCheck, extRewrite, extRewriteEnter, lang, prettyPrint, prettyPrint, prettyPrint, prettyPrint, throwTypes, translate, typeCheckEnter, typeCheckOverride, visitChild, visitList
protected java.util.List<ClassMember> members
public ClassBody_c(Position pos, java.util.List<ClassMember> members)
public ClassBody_c(Position pos, java.util.List<ClassMember> members, Ext ext)
public java.util.List<ClassMember> members()
ClassBody
members
in interface ClassBody
ClassMember
.public ClassBody members(java.util.List<ClassMember> members)
ClassBody
members
in interface ClassBody
members
- A list of ClassMember
.protected <N extends ClassBody_c> N members(N n, java.util.List<ClassMember> members)
public ClassBody addMember(ClassMember member)
ClassBody
protected <N extends ClassBody_c> N reconstruct(N n, java.util.List<ClassMember> members)
public Node visitChildren(NodeVisitor v)
NodeOps
visitChildren
in interface NodeOps
visitChildren
in class Node_c
v
- The visitor that will traverse/rewrite the AST.this
.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 Node disambiguate(AmbiguityRemover ar) throws SemanticException
NodeOps
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.
The node should not assume that its children have been disambiguated.
If it depends on a child being disambiguated,
it may just return this
without doing any work.disambiguate
in interface NodeOps
disambiguate
in class Node_c
ar
- The visitor which disambiguates.SemanticException
protected void duplicateFieldCheck(TypeChecker tc) throws SemanticException
SemanticException
protected void duplicateConstructorCheck(TypeChecker tc) throws SemanticException
SemanticException
protected void duplicateMethodCheck(TypeChecker tc) throws SemanticException
SemanticException
protected void duplicateMemberClassCheck(TypeChecker tc) throws SemanticException
SemanticException
protected boolean isSameMethod(TypeSystem ts, MethodInstance mi, MethodInstance mj)
public Node typeCheck(TypeChecker tc) throws SemanticException
NodeOps
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.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)
Node_c
CodeWriter
.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 Term firstChild()
TermOps
firstChild
in interface TermOps
firstChild
in class Term_c
public <T> java.util.List<T> acceptCFG(CFGBuilder<?> v, java.util.List<T> succs)
TermOps