|
|||||||||
| 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.Expr_c
polyglot.ext.jl.ast.New_c
public class New_c
A New is an immutable representation of the use of the
new operator to create a new instance of a class. In
addition to the type of the class being created, a New has a
list of arguments to be passed to the constructor of the object and an
optional ClassBody used to support anonymous classes.
| Field Summary | |
|---|---|
protected ParsedClassType |
anonType
|
protected java.util.List |
arguments
|
protected ClassBody |
body
|
protected ConstructorInstance |
ci
|
protected Expr |
qualifier
|
protected TypeNode |
tn
|
| Fields inherited from class polyglot.ext.jl.ast.Expr_c |
|---|
type |
| 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 | |
|---|---|
New_c(Position pos,
Expr qualifier,
TypeNode tn,
java.util.List arguments,
ClassBody body)
|
|
| Method Summary | |
|---|---|
java.util.List |
acceptCFG(CFGBuilder v,
java.util.List succs)
Visit this term in evaluation order. |
ParsedClassType |
anonType()
The type object for anonymous classes, or null. |
New |
anonType(ParsedClassType anonType)
Set the type object for anonymous classes. |
java.util.List |
arguments()
Actual arguments to pass to the constructor. |
ProcedureCall |
arguments(java.util.List arguments)
Set the actual arguments to pass to the constructor. |
ClassBody |
body()
The class body for anonymous classes, or null. |
New |
body(ClassBody body)
Set the class body for anonymous classes. |
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. |
Type |
childExpectedType(Expr child,
AscriptionVisitor av)
Get the expected type of a child expression of this. |
ConstructorInstance |
constructorInstance()
The constructor invoked by this expression. |
New |
constructorInstance(ConstructorInstance ci)
Set the constructor invoked by this expression. |
Node |
disambiguate(AmbiguityRemover ar)
Remove any remaining ambiguities from the AST. |
NodeVisitor |
disambiguateEnter(AmbiguityRemover ar)
Remove any remaining ambiguities from the AST. |
protected TypeNode |
disambiguateTypeNode(TypeChecker tc,
ClassType ct)
|
Context |
enterScope(Node child,
Context c)
Push a new scope for visiting the child node child. |
Term |
entry()
Return the first (sub)term performed when evaluating this term. |
Node |
exceptionCheck(ExceptionChecker ec)
Check that exceptions are properly propagated throughout the AST. |
TypeNode |
objectType()
Get the type we are instantiating. |
New |
objectType(TypeNode tn)
Set the type we are instantiating. |
protected TypeNode |
partialDisambTypeNode(TypeNode tn,
TypeChecker tc,
ClassType outer)
|
Precedence |
precedence()
Get the precedence of the expression. |
void |
prettyPrint(CodeWriter w,
PrettyPrinter tr)
Pretty-print the AST using the given CodeWriter. |
protected void |
printArgs(CodeWriter w,
PrettyPrinter tr)
|
protected void |
printBody(CodeWriter w,
PrettyPrinter tr)
|
protected void |
printQualifier(CodeWriter w,
PrettyPrinter tr)
|
ProcedureInstance |
procedureInstance()
The type object of the method we are calling. |
Expr |
qualifier()
Get the qualifier expression of the allocation. |
New |
qualifier(Expr qualifier)
Set the qualifier expression of the allocation. |
protected New_c |
reconstruct(Expr qualifier,
TypeNode tn,
java.util.List arguments,
ClassBody body)
Reconstruct the expression. |
java.util.List |
throwTypes(TypeSystem ts)
List of Types of exceptions that might get thrown. |
java.lang.String |
toString()
|
void |
translate(CodeWriter w,
Translator tr)
Translate the AST using the given CodeWriter. |
Node |
typeCheck(TypeChecker tc)
Type check the AST. |
protected ClassBody |
typeCheckBody(TypeChecker tc,
ClassType superType)
|
NodeVisitor |
typeCheckEnter(TypeChecker tc)
Type check the AST. |
protected Node |
typeCheckEpilogue(TypeChecker tc)
|
Node |
visitChildren(NodeVisitor v)
Visit the children of the expression. |
| Methods inherited from class polyglot.ext.jl.ast.Expr_c |
|---|
booleanValue, byteValue, charValue, constantValue, doubleValue, dump, floatValue, intValue, isConstant, longValue, printSubExpr, printSubExpr, shortValue, stringValue, type, type |
| 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, addMembersEnter, addMembersOverride, buildTypesOverride, copy, del, del, disambiguateOverride, enterScope, exceptionCheckEnter, exceptionCheckOverride, ext, ext, ext, ext, init, node, position, position, print, printBlock, printSubStmt, 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.Expr |
|---|
constantValue, isConstant, printSubExpr, printSubExpr, type |
| Methods inherited from interface polyglot.ast.Node |
|---|
del, del, dump, 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, addMembersEnter, enterScope, exceptionCheckEnter |
| Methods inherited from interface polyglot.util.Copy |
|---|
copy |
| Methods inherited from interface polyglot.ast.Typed |
|---|
type |
| Methods inherited from interface polyglot.ast.Term |
|---|
exceptions, exceptions, reachable, reachable |
| Methods inherited from interface polyglot.ast.Term |
|---|
exceptions, exceptions, reachable, reachable |
| Field Detail |
|---|
protected Expr qualifier
protected TypeNode tn
protected java.util.List arguments
protected ClassBody body
protected ConstructorInstance ci
protected ParsedClassType anonType
| Constructor Detail |
|---|
public New_c(Position pos,
Expr qualifier,
TypeNode tn,
java.util.List arguments,
ClassBody body)
| Method Detail |
|---|
public Expr qualifier()
qualifier in interface Newpublic New qualifier(Expr qualifier)
qualifier in interface Newpublic TypeNode objectType()
objectType in interface Newpublic New objectType(TypeNode tn)
objectType in interface Newpublic ParsedClassType anonType()
New
anonType in interface Newpublic New anonType(ParsedClassType anonType)
New
anonType in interface Newpublic ProcedureInstance procedureInstance()
ProcedureCall
procedureInstance in interface ProcedureCallpublic ConstructorInstance constructorInstance()
New
constructorInstance in interface Newpublic New constructorInstance(ConstructorInstance ci)
New
constructorInstance in interface Newpublic java.util.List arguments()
New
arguments in interface Newarguments in interface ProcedureCallExpr.public ProcedureCall arguments(java.util.List arguments)
New
arguments in interface Newarguments in interface ProcedureCallarguments - A list of Expr.public ClassBody body()
New
body in interface Newpublic New body(ClassBody body)
New
body in interface New
protected New_c reconstruct(Expr qualifier,
TypeNode tn,
java.util.List arguments,
ClassBody body)
public Node visitChildren(NodeVisitor v)
visitChildren in interface NodeOpsvisitChildren in class Node_cv - The visitor that will traverse/rewrite the AST.
this.
public Context enterScope(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.
enterScope in interface NodeOpsenterScope in class Node_cchild - the child node about to be entered.c - the current Context
Context to be used for visiting node
child
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 Expr_ctb - The visitor which adds new type objects to the
TypeSystem.
SemanticException
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_car - The visitor which disambiguates.
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.
disambiguate in interface NodeOpsdisambiguate in class Node_car - The visitor which disambiguates.
SemanticException
public NodeVisitor typeCheckEnter(TypeChecker tc)
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.
typeCheckEnter in interface NodeOpstypeCheckEnter in class Node_ctc - The type checking visitor.
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.
SemanticException
protected Node typeCheckEpilogue(TypeChecker tc)
throws SemanticException
SemanticException
protected TypeNode partialDisambTypeNode(TypeNode tn,
TypeChecker tc,
ClassType outer)
throws SemanticException
SemanticException
protected TypeNode disambiguateTypeNode(TypeChecker tc,
ClassType ct)
throws SemanticException
SemanticException
protected ClassBody typeCheckBody(TypeChecker tc,
ClassType superType)
throws SemanticException
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 Node exceptionCheck(ExceptionChecker ec)
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.
exceptionCheck in interface NodeOpsexceptionCheck in class Term_cec - The visitor.
SemanticExceptionpublic Precedence precedence()
precedence in interface Exprprecedence in class Expr_cpublic java.lang.String toString()
toString in class Node_c
protected void printQualifier(CodeWriter w,
PrettyPrinter tr)
protected void printArgs(CodeWriter w,
PrettyPrinter tr)
protected void printBody(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 translate(CodeWriter w,
Translator tr)
Node_cCodeWriter.
translate in interface NodeOpstranslate in class Node_cw - The code writer to which to write.tr - The translation pass. This is not a visitor.public Term entry()
Term_c
entry in interface Termentry in class Term_c
public java.util.List acceptCFG(CFGBuilder v,
java.util.List succs)
Term_c
acceptCFG in interface TermacceptCFG in class Term_cpublic java.util.List throwTypes(TypeSystem ts)
NodeOps
throwTypes in interface NodeOpsthrowTypes in class Node_c
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||