|
|||||||||
| 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.ClassDecl_c
public class ClassDecl_c
A ClassDecl is the definition of a class, abstract class,
or interface. It may be a public or other top-level class, or an inner
named class, or an anonymous class.
| Field Summary | |
|---|---|
protected ClassBody |
body
|
protected ConstructorInstance |
defaultCI
|
protected Flags |
flags
|
protected java.util.List |
interfaces
|
protected Id |
name
|
protected TypeNode |
superClass
|
protected ParsedClassType |
type
|
| Fields inherited from class polyglot.ast.Term_c |
|---|
exceptions, reachable |
| Fields inherited from class polyglot.ast.Node_c |
|---|
del, error, ext, position |
| Constructor Summary | |
|---|---|
ClassDecl_c(Position pos,
Flags flags,
Id name,
TypeNode superClass,
java.util.List interfaces,
ClassBody body)
|
|
| Method Summary | |
|---|---|
java.util.List |
acceptCFG(CFGBuilder v,
java.util.List succs)
Visit this term in evaluation order. |
protected Node |
addDefaultConstructor(TypeSystem ts,
NodeFactory nf)
|
protected Node |
addDefaultConstructorIfNeeded(TypeSystem ts,
NodeFactory nf)
|
ClassBody |
body()
The class's body. |
ClassDecl |
body(ClassBody body)
Set the class's body. |
Node |
buildTypes(TypeBuilder tb)
Collects classes, methods, and fields from the AST rooted at this node and constructs type objects for these. |
NodeVisitor |
buildTypesEnter(TypeBuilder tb)
Collects classes, methods, and fields from the AST rooted at this node and constructs type objects for these. |
protected void |
checkSupertypeCycles(TypeSystem ts)
|
Node |
copy(NodeFactory nf)
Produce a copy of this node using the given NodeFactory. |
protected boolean |
defaultConstructorNeeded()
|
Node |
disambiguate(AmbiguityRemover ar)
Remove any remaining ambiguities from the AST. |
Node |
disambiguateOverride(Node parent,
AmbiguityRemover ar)
Disambiguate the AST. |
protected ClassDecl_c |
disambiguateSupertypes(AmbiguityRemover ar)
|
void |
dump(CodeWriter w)
Dump the AST node for debugging purposes. |
Context |
enterChildScope(Node child,
Context c)
Push a new scope for visiting the child node child. |
Term |
firstChild()
Return the first (sub)term performed when evaluating this term. |
Flags |
flags()
The class declaration's flags. |
ClassDecl |
flags(Flags flags)
Set the class declaration's flags. |
Id |
id()
The class declaration's name. |
ClassDecl |
id(Id name)
Set the class declaration's name. |
java.util.List |
interfaces()
The class's interface list. |
ClassDecl |
interfaces(java.util.List interfaces)
Set the class's interface list. |
boolean |
isDisambiguated()
|
MemberInstance |
memberInstance()
|
java.lang.String |
name()
The class declaration's name. |
ClassDecl |
name(java.lang.String name)
Set the class declaration's name. |
void |
prettyPrint(CodeWriter w,
PrettyPrinter tr)
Pretty-print the AST using the given CodeWriter. |
void |
prettyPrintFooter(CodeWriter w,
PrettyPrinter tr)
|
void |
prettyPrintHeader(CodeWriter w,
PrettyPrinter tr)
|
protected ClassDecl_c |
reconstruct(Id name,
TypeNode superClass,
java.util.List interfaces,
ClassBody body)
|
protected void |
setInterfaces(AmbiguityRemover ar,
java.util.List newInterfaces)
|
protected void |
setSuperClass(AmbiguityRemover ar,
TypeNode superClass)
|
TypeNode |
superClass()
The class's super class. |
ClassDecl |
superClass(TypeNode superClass)
Set the class's super class. |
java.lang.String |
toString()
|
ParsedClassType |
type()
The type of the class declaration. |
ClassDecl |
type(ParsedClassType type)
Set the type of the class declaration. |
Node |
typeCheck(TypeChecker tc)
Type check the AST. |
Node |
visitChildren(NodeVisitor v)
Visit the children of the node. |
| 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, disambiguateEnter, dump, dump, enterScope, error, error, exceptionCheckEnter, 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 |
| Field Detail |
|---|
protected Flags flags
protected Id name
protected TypeNode superClass
protected java.util.List interfaces
protected ClassBody body
protected ConstructorInstance defaultCI
protected ParsedClassType type
| Constructor Detail |
|---|
public ClassDecl_c(Position pos,
Flags flags,
Id name,
TypeNode superClass,
java.util.List interfaces,
ClassBody body)
| Method Detail |
|---|
public boolean isDisambiguated()
isDisambiguated in interface NodeisDisambiguated in class Node_cpublic MemberInstance memberInstance()
memberInstance in interface ClassMemberpublic ParsedClassType type()
ClassDecl
type in interface ClassDeclpublic ClassDecl type(ParsedClassType type)
ClassDecl
type in interface ClassDeclpublic Flags flags()
ClassDecl
flags in interface ClassDeclflags in interface TopLevelDeclpublic ClassDecl flags(Flags flags)
ClassDecl
flags in interface ClassDeclpublic Id id()
ClassDecl
id in interface ClassDeclpublic ClassDecl id(Id name)
ClassDecl
id in interface ClassDeclpublic java.lang.String name()
ClassDecl
name in interface ClassDeclname in interface TopLevelDeclpublic ClassDecl name(java.lang.String name)
ClassDecl
name in interface ClassDeclpublic TypeNode superClass()
ClassDecl
superClass in interface ClassDeclpublic ClassDecl superClass(TypeNode superClass)
ClassDecl
superClass in interface ClassDeclpublic java.util.List interfaces()
ClassDecl
interfaces in interface ClassDeclTypeNode.public ClassDecl interfaces(java.util.List interfaces)
ClassDecl
interfaces in interface ClassDeclinterfaces - A list of TypeNode.public ClassBody body()
ClassDecl
body in interface ClassDeclpublic ClassDecl body(ClassBody body)
ClassDecl
body in interface ClassDecl
protected ClassDecl_c reconstruct(Id name,
TypeNode superClass,
java.util.List interfaces,
ClassBody body)
public Term firstChild()
firstChild in interface Term
public java.util.List acceptCFG(CFGBuilder v,
java.util.List succs)
acceptCFG in interface TermacceptCFG in class Term_cpublic Node visitChildren(NodeVisitor v)
NodeOps
visitChildren in interface NodeOpsvisitChildren in class Node_cv - The visitor that will traverse/rewrite the AST.
this.
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_ctb - The visitor which adds new type objects to the
TypeSystem.
SemanticException
public Node buildTypes(TypeBuilder tb)
throws SemanticException
NodeOpsTypeSystem.
This method is called by the 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.
buildTypes in interface NodeOpsbuildTypes in class Node_ctb - The visitor which adds new type objects to the
TypeSystem.
SemanticException
public Context enterChildScope(Node child,
Context c)
Node_cchild.
The default behavior is to delegate the call to the child node, and let
it add appropriate declarations that should be in scope. However,
this method gives parent nodes have the ability to modify this behavior.
enterChildScope in interface NodeOpsenterChildScope in class Node_cchild - the child node about to be entered.c - the current Context
Context to be used for visiting node
child
public Node disambiguate(AmbiguityRemover ar)
throws SemanticException
NodeOpsleave() 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 NodeOpsdisambiguate in class Node_car - The visitor which disambiguates.
SemanticException
protected ClassDecl_c disambiguateSupertypes(AmbiguityRemover ar)
throws SemanticException
SemanticException
protected void checkSupertypeCycles(TypeSystem ts)
throws SemanticException
SemanticException
protected void setSuperClass(AmbiguityRemover ar,
TypeNode superClass)
throws SemanticException
SemanticException
protected void setInterfaces(AmbiguityRemover ar,
java.util.List newInterfaces)
throws SemanticException
SemanticException
protected Node addDefaultConstructorIfNeeded(TypeSystem ts,
NodeFactory nf)
throws SemanticException
SemanticExceptionprotected boolean defaultConstructorNeeded()
protected Node addDefaultConstructor(TypeSystem ts,
NodeFactory nf)
throws SemanticException
SemanticException
public Node typeCheck(TypeChecker tc)
throws SemanticException
NodeOpsleave() 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 NodeOpstypeCheck in class Node_ctc - The type checking visitor.
SemanticExceptionpublic java.lang.String toString()
toString in class Node_c
public void prettyPrintHeader(CodeWriter w,
PrettyPrinter tr)
public void prettyPrintFooter(CodeWriter w,
PrettyPrinter tr)
public void prettyPrint(CodeWriter w,
PrettyPrinter tr)
Node_cCodeWriter.
prettyPrint in interface NodeOpsprettyPrint in class Node_cw - 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 Nodedump in class Node_c
public Node disambiguateOverride(Node parent,
AmbiguityRemover ar)
throws SemanticException
NodeOpsoverride() method of the
visitor. If this method returns non-null, the node's children
will not be visited automatically. Thus, the method should check
both the node this and it's children, usually by
invoking visitChildren with tc or
with another visitor, returning a non-null node. OR, the method
should do nothing and simply return null to allow
enter, visitChildren, and leave
to be invoked on the node.
The default implementation returns null.
Overriding of this method is discouraged, but sometimes necessary.
disambiguateOverride in interface NodeOpsdisambiguateOverride in class Node_cparent - ar -
SemanticExceptionpublic Node copy(NodeFactory nf)
NodeOps
copy in interface NodeOpscopy in class Node_c
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||