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, type
exceptions, exceptions, exceptions, listChild, reachable, reachable, reachable
addDecls, 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, visitList
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
constantValue, constantValueSet, isConstant, printSubExpr, printSubExpr, type
del, del, error, error, ext, ext, ext, ext, isDisambiguated, isTypeChecked, position, position, visit, visitEdge
addDecls, buildTypesEnter, checkConstants, copy, disambiguate, disambiguateEnter, disambiguateOverride, dump, dump, dump, dump, enterChildScope, enterScope, exceptionCheckEnter, lang, prettyPrint, prettyPrint, prettyPrint, prettyPrint, translate, typeCheckEnter, typeCheckOverride, visitChild, visitList
exceptions, exceptions, reachable, reachable
constantValue, constantValueSet, isConstant
protected Receiver target
protected Id name
protected java.util.List<Expr> arguments
protected MethodInstance mi
protected boolean targetImplicit
public Precedence precedence()
Expr
precedence
in interface Expr
precedence
in class Expr_c
public Receiver target()
Call
public Call target(Receiver target)
Call
public Call id(Id name)
Call
public java.lang.String name()
Call
public Call name(java.lang.String name)
Call
public ProcedureInstance procedureInstance()
ProcedureCall
procedureInstance
in interface ProcedureCall
public MethodInstance methodInstance()
Call
methodInstance
in interface Call
public Call methodInstance(MethodInstance mi)
Call
methodInstance
in interface Call
protected <N extends Call_c> N methodInstance(N n, MethodInstance mi)
public boolean isTargetImplicit()
Call
isTargetImplicit
in interface Call
public Call targetImplicit(boolean targetImplicit)
Call
targetImplicit
in interface Call
protected <N extends Call_c> N targetImplicit(N n, boolean targetImplicit)
public java.util.List<Expr> arguments()
ProcedureCall
arguments
in interface ProcedureCall
Expr
.public ProcedureCall arguments(java.util.List<Expr> arguments)
ProcedureCall
arguments
in interface ProcedureCall
arguments
- 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)
NodeOps
visitChildren
in interface NodeOps
visitChildren
in class Node_c
v
- The visitor that will traverse/rewrite the AST.this
.public Node buildTypes(TypeBuilder tb) throws SemanticException
NodeOps
TypeSystem
.
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 NodeOps
buildTypes
in class Expr_c
tb
- The visitor which adds new type objects to the
TypeSystem
.SemanticException
public Node typeCheckNullTarget(TypeChecker tc, java.util.List<Type> argTypes) throws SemanticException
CallOps
typeCheckNullTarget
in interface CallOps
argTypes
- list of Type
s of the argumentsSemanticException
public Type findContainer(TypeSystem ts, MethodInstance mi)
CallOps
findContainer
in interface CallOps
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 ReferenceType findTargetType() throws SemanticException
findTargetType
in interface CallOps
SemanticException
public Type childExpectedType(Expr child, AscriptionVisitor av)
NodeOps
this
.
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 NodeOps
childExpectedType
in class Node_c
child
- A child expression of this node.av
- An ascription visitor.child
.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 void printArgs(CodeWriter w, PrettyPrinter tr)
printArgs
in interface ProcedureCallOps
public void dump(CodeWriter w)
Node
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
public Node exceptionCheck(ExceptionChecker ec) 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.exceptionCheck
in interface NodeOps
exceptionCheck
in class Term_c
ec
- The visitor.SemanticException
public java.util.List<Type> throwTypes(TypeSystem ts)
NodeOps
throwTypes
in interface NodeOps
throwTypes
in class Node_c
public NodeVisitor extRewriteEnter(ExtensionRewriter rw) 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.extRewriteEnter
in interface NodeOps
extRewriteEnter
in class Node_c
rw
- The visitor.SemanticException
public Node extRewrite(ExtensionRewriter rw) 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.extRewrite
in interface NodeOps
extRewrite
in class Expr_c
rw
- The visitor.SemanticException