- All Superinterfaces:
Sourceable,Statement
A function call or spawn. Either of the form f(x) or else v=f(x). The
function expression is set only once if the function called is known
statically.
-
Nested Class Summary
Nested classes/interfaces inherited from interface dev.civl.mc.model.IF.statement.Statement
Statement.StatementKind -
Method Summary
Modifier and TypeMethodDescriptionfunction()TODO: get rid of itbooleanisCall()Is this a call (not spawn)?booleanbooleanisRun()Pre-condition:isSpawn()== truebooleanisSpawn()Is this a spawn (not call)?booleanCheck if the statement is calling a system function.lhs()replaceWith(ConditionalExpression oldExpression, Expression newExpression) Return a new statement by copying this statement and modifying it as well as its guard by replacing a certain conditional expression with a expression, used when translating away conditional expression WITHOUT introducing temporary variables.voidsetArguments(List<Expression> arguments) voidsetAsRun(boolean isRun) Pre-condition:isSpawn()== truevoidsetFunction(FunctionIdentifierExpression function) TODO: get rid of this, but updates the function expression instead.voidsetLhs(LHSExpression lhs) Methods inherited from interface dev.civl.mc.model.IF.Sourceable
getSourceMethods inherited from interface dev.civl.mc.model.IF.statement.Statement
calculateConstantValue, calculateDerefs, containsHere, freeVariables, guard, hasDerefs, isPurelyLocal, locationStepString, lowestScope, model, purelyLocalAnalysisOfVariables, reachable, reached, replaceWith, setCIVLSource, setGuard, setModel, setSource, setSourceTemp, setTarget, setTargetTemp, source, statementKind, statementScope, summaryOfSource, target, toStepString, variableAddressedOf, variableAddressedOf
-
Method Details
-
isCall
boolean isCall()Is this a call (not spawn)?- Returns:
- true iff this is a call
-
isSpawn
boolean isSpawn()Is this a spawn (not call)?- Returns:
- true iff this is a spawn
-
isRun
boolean isRun()Pre-condition:
Is this a spawn for $run statement ?isSpawn()== true- Returns:
- true if and only if this is a spawn and it is translated from a $run statement.
-
isInitializer
boolean isInitializer()- Returns:
- true iff the
lhs()expression will be initialized by the return value of this call statement, i.e. the function call is an initializer of a declaration.
-
lhs
LHSExpression lhs()- Returns:
- The left hand side expression if applicable. Else null.
-
function
CIVLFunction function()TODO: get rid of it- Returns:
- The function being called.
-
arguments
List<Expression> arguments()- Returns:
- The arguments to the function.
-
setLhs
- Parameters:
lhs- The left hand side expression if applicable. Else null.
-
setAsRun
void setAsRun(boolean isRun) Pre-condition:
Set the statement as a $spawn for $run. i.e. A $spawn statement which is translated from a $run statement.isSpawn()== true- Parameters:
isRun-
-
setFunction
TODO: get rid of this, but updates the function expression instead.- Parameters:
function- The function being called.
-
setArguments
- Parameters:
arguments- The arguments to the function.
-
isSystemCall
boolean isSystemCall()Check if the statement is calling a system function.- Returns:
-
functionExpression
Expression functionExpression() -
replaceWith
Description copied from interface:StatementReturn a new statement by copying this statement and modifying it as well as its guard by replacing a certain conditional expression with a expression, used when translating away conditional expression WITHOUT introducing temporary variables. The original statement can't be modified, because it needs to be used twice to generate the if branch statement and the else branch statement.
For example,x = a ? b : cwill be translated intoif(a) x = b; else x = c;
Another example,$when(a?b:c) x = k;will be translated intoif(a) $when(b) x=k; else $when(c) x=k;- Specified by:
replaceWithin interfaceStatement- Parameters:
oldExpression- The conditional expression to be cleared.newExpression- The new expression to take place of the conditional expression. Usually, it is one of the choice expressions of the conditional expression.- Returns:
- A new statement without the conditional expression
-