|
JML | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.multijava.util.Utils
org.multijava.util.compiler.Phylum
org.multijava.mjc.JPhylum
org.multijava.mjc.JExpression
org.multijava.mjc.JMethodCallExpression
This class represents method calls
methodname( e1, e2, ..., en )
| Field Summary | |
private JLocalVariable[] |
argLocalVars
an array of local variables used as temps for the args of the call. |
protected JExpression[] |
args
|
private boolean |
doSetContext
|
protected String |
ident
|
private boolean |
isCase_s_e2
Tracks whether the invocation is of a super class method that belongs to the same external generic function as the caller but is declared in a different compilation unit (Clifton-01, Figure 24, case s-e2). |
private CMethod |
localMethod
A local method of the generic function targeted by this invocation. |
protected CMethod |
method
The method invoked by this method call, as determined by the static receiver and argument types. |
protected JExpression |
prefix
|
private JExpression |
repObject
|
private JIfStatement |
repTest
|
private JMethodCallExpression |
resetContext
|
private JMethodCallExpression |
setContext
|
private boolean |
skipLocalFunction
Tracks whether invocation is of a super class method that belongs to an external generic function (Clifton-01, Figure 24, cases s-i3, s-e2, or s-e3) where a local method of the target generic function must be skipped in the chain-of-responsibility. |
private JNameExpression |
sourceName
the name of this field reference as originally appeared in the source file. |
private JLocalVariable |
tmpLocalVar
|
protected CMethod |
topConcreteMethod
The top concrete method of the generic function invoked by this method call. |
private CType |
type
|
| Fields inherited from class org.multijava.mjc.JExpression |
EMPTY |
| Fields inherited from class org.multijava.util.compiler.Phylum |
|
| Fields inherited from class org.multijava.util.Utils |
DBG_LEVEL_HIGH, DBG_LEVEL_LOW, DBG_LEVEL_NO |
| Constructor Summary | |
protected |
JMethodCallExpression(TokenReference where,
JExpression prefix,
String ident,
JExpression[] args)
Constructs a method call node of an AST. |
|
JMethodCallExpression(TokenReference where,
JExpression prefix,
String ident,
JExpression[] args,
boolean doSetContext)
Constructs a method call node of an AST. |
|
JMethodCallExpression(TokenReference where,
JExpression prefix,
JExpression[] args)
Construct a node in the parsing tree This method is directly called by the parser |
| Method Summary | |
void |
accept(MjcVisitor p)
Accepts the specified visitor |
JExpression[] |
args()
|
protected CType[] |
checkArgumentTypes(CExpressionContextType context)
Typechecks args and returns an array of the argument types. |
private void |
checkMethodFound(CMethod found,
CType[] argTypes)
Builds an error message and throws an exception if found is null. |
private void |
checkParameterUniverses(CExpressionContextType context,
CUniverse prefix_universe,
boolean non_pure_through_pivot)
Check the universe types of the parameters. |
private void |
ensurePrefixIsInitialized(CExpressionContextType context)
Ensures that, if the target method is not static, then the prefix field contains an appropriate expression that evaluates to the method's receiver. |
protected void |
genActualArgLoads(CodeSequence code)
Plants the code for loading the actual args from their local vars. |
protected void |
genActualArgs(CodeSequence code)
Plants the code for putting the args to the call on the stack. |
protected void |
genActualArgStores(CodeSequence code)
Plants the code for storing the actual args to local variables. |
void |
genCode(CodeSequence code)
Generates a sequence of bytecodes. |
protected void |
genExternalTargetRef(CodeSequence code)
Plants the code for putting a reference to the appropriate dispatcher in the chain-of-responsibility onto the stack. |
protected void |
genInvocationOpcode(CodeSequence code)
Generates the bytecode for invoking the actual target method. |
private void |
genPrefix(CodeSequence code)
Generates the bytecode for adding the prefix to the JVM stack. |
CType |
getType()
|
protected void |
handleSuperPrefix(CType[] argTypes,
CExpressionContextType context)
Handles processing of cases where prefix is a super expression, including various hacks for
MultiJava super sends and for super sends to inner and outer
classes. |
String |
ident()
|
boolean |
isStatementExpression()
Returns true iff this expression can be used as a statement (JLS 14.7) |
protected CMethod |
lookupMethod(CType[] argTypes,
CExpressionContextType context)
Returns the apparent target method for this call. |
CMethod |
method()
Returns the method being called. |
JExpression |
prefix()
|
private void |
processExceptions(CExpressionContextType context)
Processes the exceptions thrown by the target method and registers them with the context. |
protected void |
resolveExternalMethods(CExpressionContextType context)
Makes sure any external generic functions that are implicitly imported are actually available in the data structures. |
void |
setType(CType type)
|
JNameExpression |
sourceName()
Returns the name of this field reference as originally appeared in the source file. |
String |
toString()
Returns a string representation of this. |
JExpression |
typecheck(CExpressionContextType context)
Typechecks the expression and mutates the context to record information gathered during typechecking. |
private void |
typecheckUniverse(CExpressionContextType context)
Typecheck the universe properties of the method call. |
private CUniverse |
typecheckUniverseMethodOnThis(CExpressionContextType context,
CUniverse prefix_universe)
Check the properties of a method call that is performed on this, the current object, regardless of whether the call is pure or not. |
private CUniverse |
typecheckUniverseNonPureOnPivot(CExpressionContextType context,
CUniverse prefix_universe)
Check the properties of a non-pure method call that is performed through a pivot, i.e. not on this. |
private CUniverse |
typecheckUniversePureOnPivot(CExpressionContextType context,
CUniverse prefix_universe)
Check the properties of a pure method call that is performed through a pivot, i.e. not on this. |
| Methods inherited from class org.multijava.mjc.JExpression |
buildUniverseDynChecks, clone, convertType, fail, genBranch, genUniverseDynCheckCode, getApparentType, getBooleanLiteral, getLiteral, getNumberLiteral, getOrdinalLiteral, getRealLiteral, getStringLiteral, isAssignableTo, isBooleanLiteral, isConstant, isLiteral, isMaybeInitializable, isOrdinalLiteral, isRealLiteral, isStringLiteral, typecheck, unParenthesize |
| Methods inherited from class org.multijava.mjc.JPhylum |
check, check, check, check, fail, fail, warn, warn, warn, warn |
| Methods inherited from class org.multijava.util.compiler.Phylum |
getTokenReference, setTokenReference |
| Methods inherited from class org.multijava.util.Utils |
assertTrue, assertTrue, combineArrays, escapeString, escapeString, fail, fail, getFilePath, hasFlag, hasOtherFlags, parsePathParts, relativePathTo, splitQualifiedName, splitQualifiedName, stripJavaModifiers, stripNonJavaModifiers, stripPrivateModifier, unescapeString, vectorToArray, vectorToIntArray |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected JExpression prefix
protected String ident
protected JExpression[] args
private CType type
protected CMethod method
protected CMethod topConcreteMethod
private boolean skipLocalFunction
private boolean isCase_s_e2
private CMethod localMethod
private invariant skipLocalFunction ==> localMethod != null;
private JNameExpression sourceName
private JLocalVariable[] argLocalVars
private JMethodCallExpression setContext
private JMethodCallExpression resetContext
private JLocalVariable tmpLocalVar
private boolean doSetContext
private JExpression repObject
private JIfStatement repTest
| Constructor Detail |
public JMethodCallExpression(TokenReference where,
JExpression prefix,
JExpression[] args)
where - the line of this node in the source codeprefix - an expression that is a member of an object
or class representing a methodargs - the arguments of the call
protected JMethodCallExpression(TokenReference where,
JExpression prefix,
String ident,
JExpression[] args)
where - the location of this node in the source codeprefix - the receiver of the method call, or nullident - the name of the method to be invoked, must be non-nullargs - the non-receiver arguments of the call
public JMethodCallExpression(TokenReference where,
JExpression prefix,
String ident,
JExpression[] args,
boolean doSetContext)
where - the location of this node in the source codeprefix - the receiver of the method call, or nullident - the name of the method to be invoked, must be non-nullargs - the non-receiver arguments of the calldoSetContext - whether or not to create the calls to save the current
context (will be generated only when the universeDynChecks are enabled)
By scdaniel.| Method Detail |
public JNameExpression sourceName()
public JExpression prefix()
public String ident()
public JExpression[] args()
public CType getType()
JExpression
public void setType(CType type)
public CMethod method()
public boolean isStatementExpression()
isStatementExpression in class JExpressionpublic String toString()
toString in class Object
public JExpression typecheck(CExpressionContextType context)
throws PositionedError
context - the context in which this expression appears
JExpression.typecheck())
PositionedError - if the check fails
protected CType[] checkArgumentTypes(CExpressionContextType context)
throws PositionedError
requires context != null; modifiable args; ensures \result != null && \result.length == args.length;
PositionedErrorprotected void resolveExternalMethods(CExpressionContextType context)
protected CMethod lookupMethod(CType[] argTypes,
CExpressionContextType context)
throws UnpositionedError,
PositionedError
UnpositionedError
PositionedError
private void checkMethodFound(CMethod found,
CType[] argTypes)
throws CMethodNotFoundError
found is null.
ensures found != null ==> true; signals_only CMethodNotFoundError; signals (CMethodNotFoundError) found == null;
CMethodNotFoundError
protected void handleSuperPrefix(CType[] argTypes,
CExpressionContextType context)
throws UnpositionedError,
PositionedError
super expression, including various hacks for
MultiJava super sends and for super sends to inner and outer
classes.
modifies method, prefix, localMethod, skipLocalFunction, isCase_s_e2;
UnpositionedError
PositionedErrorprivate void processExceptions(CExpressionContextType context)
private void ensurePrefixIsInitialized(CExpressionContextType context)
throws PositionedError
requires context != null; modifies prefix; ensures prefix != null || method.access().isStatic();
PositionedError
private void typecheckUniverse(CExpressionContextType context)
throws PositionedError
PositionedError
private CUniverse typecheckUniverseNonPureOnPivot(CExpressionContextType context,
CUniverse prefix_universe)
throws PositionedError
PositionedError
private CUniverse typecheckUniversePureOnPivot(CExpressionContextType context,
CUniverse prefix_universe)
throws PositionedError
PositionedError
private CUniverse typecheckUniverseMethodOnThis(CExpressionContextType context,
CUniverse prefix_universe)
throws PositionedError
PositionedError
private void checkParameterUniverses(CExpressionContextType context,
CUniverse prefix_universe,
boolean non_pure_through_pivot)
throws PositionedError
PositionedErrorpublic void accept(MjcVisitor p)
p - the visitorpublic void genCode(CodeSequence code)
also public normal_behavior requires code != null; {| requires code.discardValue(); assignable \not_specified; ensures (* after executing generated code JVM stack is unchanged *); also requires !code.discardValue(); assignable \not_specified; ensures (* after executing generated code JVM stack contains result *); |}
private void genPrefix(CodeSequence code)
protected void genActualArgs(CodeSequence code)
protected void genActualArgStores(CodeSequence code)
protected void genActualArgLoads(CodeSequence code)
protected void genExternalTargetRef(CodeSequence code)
requires topConcreteMethod.isExternal(); requires (* code already contains instructions for leaving any necessary prefix object on the stack *);
protected void genInvocationOpcode(CodeSequence code)
genCode(CodeSequence).
|
JML | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||