public class Call_c extends Expr_c implements Call, CallOps
Call is an immutable representation of a Java
method call. It consists of a method name and a list of arguments.
It may also have either a Type upon which the method is being
called or an expression upon which the method is being called.Term.Instance| Modifier and Type | Field and Description |
|---|---|
protected java.util.List<Expr> |
arguments |
protected MethodInstance |
mi |
protected Id |
name |
protected Receiver |
target |
protected boolean |
targetImplicit |
exceptions, reachable| Constructor and Description |
|---|
Call_c(Position pos,
Receiver target,
Id name,
java.util.List<Expr> arguments) |
Call_c(Position pos,
Receiver target,
Id name,
java.util.List<Expr> arguments,
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.
|
java.util.List<Expr> |
arguments()
The call's actual arguments.
|
ProcedureCall |
arguments(java.util.List<Expr> arguments)
Set the call's actual arguments.
|
protected <N extends Call_c> |
arguments(N n,
java.util.List<Expr> arguments) |
Node |
buildTypes(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. |
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.
|
Node |
exceptionCheck(ExceptionChecker ec)
Check that exceptions are properly propagated throughout the AST.
|
Node |
extRewrite(ExtensionRewriter rw)
Rewrite the AST for the compilation in this language.
|
NodeVisitor |
extRewriteEnter(ExtensionRewriter rw)
Rewrite the AST for the compilation in this language.
|
Type |
findContainer(TypeSystem ts,
MethodInstance mi)
Used to find the missing static target of a static method call.
|
ReferenceType |
findTargetType() |
Term |
firstChild()
Return the first direct subterm performed when evaluating this term.
|
Id |
id()
The name of the method to call.
|
Call |
id(Id name)
Set the name of the method to call.
|
protected <N extends Call_c> |
id(N n,
Id name) |
boolean |
isTargetImplicit()
Indicates if the target of this call is implicit, that
is, was not specified explicitly in the syntax.
|
MethodInstance |
methodInstance()
The method instance of the method to call.
|
Call |
methodInstance(MethodInstance mi)
Set the method instance of the method to call.
|
protected <N extends Call_c> |
methodInstance(N n,
MethodInstance mi) |
java.lang.String |
name()
The name of the method to call.
|
Call |
name(java.lang.String name)
Set the name of the method to call.
|
Precedence |
precedence()
Get the precedence of the expression.
|
void |
prettyPrint(CodeWriter w,
PrettyPrinter tr)
Pretty-print the AST using the given
CodeWriter. |
void |
printArgs(CodeWriter w,
PrettyPrinter tr) |
ProcedureInstance |
procedureInstance()
The type object of the procedure we are calling.
|
protected <N extends Call_c> |
reconstruct(N n,
Receiver target,
Id name,
java.util.List<Expr> arguments)
Reconstruct the call.
|
Receiver |
target()
The call's target object or type.
|
protected <N extends Call_c> |
target(N n,
Receiver target) |
Call |
target(Receiver target)
Set the call's target or type.
|
Call |
targetImplicit(boolean targetImplicit)
Set whether the target of this call is implicit.
|
protected <N extends Call_c> |
targetImplicit(N n,
boolean targetImplicit) |
java.util.List<Type> |
throwTypes(TypeSystem ts)
List of Types of exceptions that might get thrown.
|
java.lang.String |
toString() |
Node |
typeCheck(TypeChecker tc)
Type check the AST.
|
Node |
typeCheckNullTarget(TypeChecker tc,
java.util.List<Type> argTypes)
Typecheck the Call when the target is null.
|
Node |
visitChildren(NodeVisitor v)
Visit the children of the node.
|
booleanValue, byteValue, charValue, constantValue, constantValue, constantValueSet, constantValueSet, doubleValue, floatValue, intValue, isConstant, isConstant, isTypeChecked, lastLang, longValue, printSubExpr, printSubExpr, shortValue, stringValue, type, type, typeexceptions, exceptions, exceptions, listChild, reachable, reachable, reachableaddDecls, buildTypesEnter, checkConstants, copy, copy, copyIfNeeded, del, del, disambiguate, disambiguateEnter, disambiguateOverride, dump, dump, dump, dump, enterChildScope, enterScope, error, error, error, exceptionCheckEnter, ext, ext, ext, ext, isDisambiguated, lang, position, position, position, prettyPrint, prettyPrint, prettyPrint, prettyPrint, print, printBlock, printSubStmt, translate, typeCheckEnter, typeCheckOverride, visit, visitChild, visitEdge, visitListclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitconstantValue, constantValueSet, isConstant, printSubExpr, printSubExpr, typedel, del, error, error, ext, ext, ext, ext, isDisambiguated, isTypeChecked, position, position, visit, visitEdgeaddDecls, buildTypesEnter, checkConstants, copy, disambiguate, disambiguateEnter, disambiguateOverride, dump, dump, dump, dump, enterChildScope, enterScope, exceptionCheckEnter, lang, prettyPrint, prettyPrint, prettyPrint, prettyPrint, translate, typeCheckEnter, typeCheckOverride, visitChild, visitListexceptions, exceptions, reachable, reachableconstantValue, constantValueSet, isConstantprotected Receiver target
protected Id name
protected java.util.List<Expr> arguments
protected MethodInstance mi
protected boolean targetImplicit
public Precedence precedence()
Exprprecedence in interface Exprprecedence in class Expr_cpublic Receiver target()
Callpublic Call target(Receiver target)
Callpublic Call id(Id name)
Callpublic java.lang.String name()
Callpublic Call name(java.lang.String name)
Callpublic ProcedureInstance procedureInstance()
ProcedureCallprocedureInstance in interface ProcedureCallpublic MethodInstance methodInstance()
CallmethodInstance in interface Callpublic Call methodInstance(MethodInstance mi)
CallmethodInstance in interface Callprotected <N extends Call_c> N methodInstance(N n, MethodInstance mi)
public boolean isTargetImplicit()
CallisTargetImplicit in interface Callpublic Call targetImplicit(boolean targetImplicit)
CalltargetImplicit in interface Callprotected <N extends Call_c> N targetImplicit(N n, boolean targetImplicit)
public java.util.List<Expr> arguments()
ProcedureCallarguments in interface ProcedureCallExpr.public ProcedureCall arguments(java.util.List<Expr> arguments)
ProcedureCallarguments in interface ProcedureCallarguments - A list of Expr.protected <N extends Call_c> N reconstruct(N n, Receiver target, Id name, java.util.List<Expr> arguments)
public Node visitChildren(NodeVisitor v)
NodeOpsvisitChildren in interface NodeOpsvisitChildren in class Node_cv - The visitor that will traverse/rewrite the AST.this.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.SemanticExceptionpublic Node typeCheckNullTarget(TypeChecker tc, java.util.List<Type> argTypes) throws SemanticException
CallOpstypeCheckNullTarget in interface CallOpsargTypes - list of Types of the argumentsSemanticExceptionpublic Type findContainer(TypeSystem ts, MethodInstance mi)
CallOpsfindContainer in interface CallOpspublic 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 ReferenceType findTargetType() throws SemanticException
findTargetType in interface CallOpsSemanticExceptionpublic Type childExpectedType(Expr child, AscriptionVisitor av)
NodeOpsthis.
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 NodeOpschildExpectedType in class Node_cchild - A child expression of this node.av - An ascription visitor.child.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 printArgs(CodeWriter w, PrettyPrinter tr)
printArgs in interface ProcedureCallOpspublic void dump(CodeWriter w)
Nodepublic Term firstChild()
TermOpsfirstChild in interface TermOpsfirstChild in class Term_cpublic <T> java.util.List<T> acceptCFG(CFGBuilder<?> v, java.util.List<T> succs)
TermOpspublic 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 java.util.List<Type> throwTypes(TypeSystem ts)
NodeOpsthrowTypes in interface NodeOpsthrowTypes in class Node_cpublic NodeVisitor extRewriteEnter(ExtensionRewriter rw) 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.extRewriteEnter in interface NodeOpsextRewriteEnter in class Node_crw - The visitor.SemanticExceptionpublic Node extRewrite(ExtensionRewriter rw) 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.extRewrite in interface NodeOpsextRewrite in class Expr_crw - The visitor.SemanticException