public class JMethodCall extends JExpression
Constructor and Description |
---|
JMethodCall(JMethodCall other,
JExpression instance,
JExpression... args)
Initialize a new method call equivalent to another one.
|
JMethodCall(JMethodCall other,
JExpression instance,
List<JExpression> args)
Initialize a new method call equivalent to another one.
|
JMethodCall(SourceInfo info,
JExpression instance,
JMethod method,
JExpression... args)
Create a method call.
|
JMethodCall(SourceInfo info,
JExpression instance,
JMethod method,
List<JExpression> args)
Create a method call.
|
Modifier and Type | Method and Description |
---|---|
void |
addArg(int index,
JExpression toAdd)
Inserts an argument at the specified index.
|
void |
addArg(JExpression toAdd)
Adds an argument to this method.
|
void |
addArgs(JExpression... toAdd)
Adds an argument to this method.
|
void |
addArgs(List<JExpression> toAdd)
Adds arguments to this method.
|
boolean |
canBePolymorphic()
Returns
true if the call can dispatch to more than possible
target method. |
JMethodCall |
cloneWithoutParameters()
Creates a new method call to the same method using the same instance but without parameters.
|
List<JExpression> |
getArgs()
Returns the call arguments.
|
JExpression |
getInstance() |
JMethod |
getTarget() |
JType |
getType()
Returns the type of this expression.
|
boolean |
hasSideEffects() |
boolean |
isStaticDispatchOnly()
Returns
true for calls that must be called statically,
e.g. |
boolean |
isVolatile()
Returns
true for calls that should not be optimized. |
void |
markSideEffectFree() |
void |
overrideReturnType(JType overridenReturnType)
Override the return type.
|
void |
resolve(JMethod newMethod)
Resolve an external reference during AST stitching.
|
void |
setArg(int index,
JExpression arg)
Sets the argument at the specified index.
|
void |
setCannotBePolymorphic()
See
canBePolymorphic() . |
void |
setStaticDispatchOnly()
|
void |
setVolatile()
See
isVolatile() . |
void |
traverse(JVisitor visitor,
Context ctx)
Causes this object to have the visitor visit itself and its children.
|
protected void |
visitChildren(JVisitor visitor) |
makeReturnStatement, makeStatement
getSourceInfo, setSourceInfo, toSource, toString
public JMethodCall(JMethodCall other, JExpression instance, JExpression... args)
public JMethodCall(JMethodCall other, JExpression instance, List<JExpression> args)
public JMethodCall(SourceInfo info, JExpression instance, JMethod method, List<JExpression> args)
public JMethodCall(SourceInfo info, JExpression instance, JMethod method, JExpression... args)
public void addArg(int index, JExpression toAdd)
public void addArg(JExpression toAdd)
public void addArgs(JExpression... toAdd)
public void addArgs(List<JExpression> toAdd)
public boolean canBePolymorphic()
true
if the call can dispatch to more than possible
target method.public JMethodCall cloneWithoutParameters()
public List<JExpression> getArgs()
public JExpression getInstance()
public JMethod getTarget()
public JType getType()
HasType
public void markSideEffectFree()
public boolean hasSideEffects()
hasSideEffects
in class JExpression
public boolean isStaticDispatchOnly()
true
for calls that must be called statically,
e.g. super.method() invocations, and super() and this() constructor calls.public boolean isVolatile()
true
for calls that should not be optimized.public void overrideReturnType(JType overridenReturnType)
The method call expression will have overridentReturnType
as its type ignoring the
return type of the target method. This is used during normalizing transformations to preserve
type semantics when calling externally-defined compiler implementation methods.
For example, Cast.dynamicCast() returns Object but that method is used to implement the cast operation. Using a stronger type on the call expression allows us to preserve type information during the latter phases of compilation.
public void resolve(JMethod newMethod)
public void setArg(int index, JExpression arg)
public void setCannotBePolymorphic()
canBePolymorphic()
.public void setStaticDispatchOnly()
public void setVolatile()
isVolatile()
.public void traverse(JVisitor visitor, Context ctx)
JNode
protected void visitChildren(JVisitor visitor)
Copyright © 2018. All rights reserved.