|
|||||||||
| 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.FieldDecl_c
public class FieldDecl_c
A FieldDecl is an immutable representation of the declaration
of a field of a class.
| Nested Class Summary | |
|---|---|
static class |
FieldDecl_c.AddDependenciesVisitor
|
| Field Summary | |
|---|---|
protected FieldInstance |
fi
|
protected Flags |
flags
|
protected InitializerInstance |
ii
|
protected Expr |
init
|
protected java.lang.String |
name
|
protected TypeNode |
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 | |
|---|---|
FieldDecl_c(Position pos,
Flags flags,
TypeNode type,
java.lang.String name,
Expr init)
|
|
| Method Summary | |
|---|---|
java.util.List |
acceptCFG(CFGBuilder v,
java.util.List succs)
Visit this term in evaluation order. |
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. |
Node |
checkConstants(ConstantChecker cc)
|
Type |
childExpectedType(Expr child,
AscriptionVisitor av)
Get the expected type of a child expression of this. |
boolean |
constantValueSet()
Whether the initializer has been determined to be constant or not. |
Type |
declType()
Get the type of the declaration. |
Node |
disambiguate(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. |
NodeVisitor |
exceptionCheckEnter(ExceptionChecker ec)
Check that exceptions are properly propagated throughout the AST. |
FieldInstance |
fieldInstance()
Get the field instance of the declaration. |
FieldDecl |
fieldInstance(FieldInstance fi)
Set the field instance of the declaration. |
Flags |
flags()
Get the flags of the declaration. |
FieldDecl |
flags(Flags flags)
Set the flags of the declaration. |
Expr |
init()
Get the initializer of the declaration. |
FieldDecl |
init(Expr init)
Set the initializer of the declaration. |
InitializerInstance |
initializerInstance()
Get the initializer instance of the initializer. |
FieldDecl |
initializerInstance(InitializerInstance ii)
Set the initializer instance of the initializer. |
boolean |
isDisambiguated()
|
MemberInstance |
memberInstance()
|
java.lang.String |
name()
Get the name of the declaration. |
FieldDecl |
name(java.lang.String name)
Set the name of the declaration. |
void |
prettyPrint(CodeWriter w,
PrettyPrinter tr)
Pretty-print the AST using the given CodeWriter. |
protected FieldDecl_c |
reconstruct(TypeNode type,
Expr init)
Reconstruct the declaration. |
java.lang.String |
toString()
|
TypeNode |
type()
Get the type node of the declaration. |
FieldDecl |
type(TypeNode type)
Set the type of the declaration. |
Node |
typeCheck(TypeChecker tc)
Type check the declaration. |
VarInstance |
varInstance()
The variable being initialized. |
Node |
visitChildren(NodeVisitor v)
Visit the children of the declaration. |
| Methods inherited from class polyglot.ast.Term_c |
|---|
exceptionCheck, exceptions, exceptions, listEntry, reachable, reachable |
| Methods inherited from class polyglot.ast.Node_c |
|---|
addDecls, copy, del, del, 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 |
|---|
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, 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 TypeNode type
protected java.lang.String name
protected Expr init
protected FieldInstance fi
protected InitializerInstance ii
| Constructor Detail |
|---|
public FieldDecl_c(Position pos,
Flags flags,
TypeNode type,
java.lang.String name,
Expr init)
| Method Detail |
|---|
public boolean isDisambiguated()
isDisambiguated in interface NodeisDisambiguated in class Node_cpublic MemberInstance memberInstance()
memberInstance in interface ClassMemberpublic VarInstance varInstance()
VarInit
varInstance in interface VarInitpublic InitializerInstance initializerInstance()
initializerInstance in interface FieldDeclpublic FieldDecl initializerInstance(InitializerInstance ii)
initializerInstance in interface FieldDeclpublic Type declType()
declType in interface FieldDeclpublic Flags flags()
flags in interface FieldDeclpublic FieldDecl flags(Flags flags)
flags in interface FieldDeclpublic TypeNode type()
type in interface FieldDeclpublic FieldDecl type(TypeNode type)
type in interface FieldDeclpublic java.lang.String name()
name in interface FieldDeclpublic FieldDecl name(java.lang.String name)
name in interface FieldDeclpublic Expr init()
init in interface FieldDeclpublic FieldDecl init(Expr init)
init in interface FieldDeclpublic FieldDecl fieldInstance(FieldInstance fi)
fieldInstance in interface FieldDeclpublic FieldInstance fieldInstance()
fieldInstance in interface FieldDecl
protected FieldDecl_c reconstruct(TypeNode type,
Expr init)
public Node visitChildren(NodeVisitor v)
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 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.
SemanticExceptionpublic Context enterScope(Context c)
Node_c
enterScope in interface NodeOpsenterScope in class Node_cc - the current Context
Context to be used for visiting this node.
public Node checkConstants(ConstantChecker cc)
throws SemanticException
checkConstants in interface NodeOpscheckConstants in class Node_cSemanticExceptionpublic boolean constantValueSet()
VarInit
constantValueSet in interface FieldDeclconstantValueSet in interface VarInit
public Node typeCheck(TypeChecker tc)
throws SemanticException
typeCheck in interface NodeOpstypeCheck in class Node_cSemanticException
public NodeVisitor exceptionCheckEnter(ExceptionChecker ec)
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.
exceptionCheckEnter in interface NodeOpsexceptionCheckEnter in class Node_cec - The visitor.
SemanticException
public Type childExpectedType(Expr child,
AscriptionVisitor av)
Nodethis.
The expected type is determined by the context in that the child occurs
(e.g., for x = e, the expected type of e is
the declared type of x.
The expected type should impose the least constraints on the child's
type that are allowed by the parent node.
childExpectedType in interface NodechildExpectedType in class Node_cchild - A child expression of this node.av - An ascription visitor.
child.public Term entry()
entry in interface Termentry in class Term_c
public java.util.List acceptCFG(CFGBuilder v,
java.util.List succs)
acceptCFG in interface TermacceptCFG in class Term_cpublic java.lang.String toString()
toString in class Node_c
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
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||