public class Subroutine extends Instruction
Executing the assignment instruction causes the expression to be evaluated and assigned to the variable, until the assignment instruction executes, the expression isn't evaluated.
Modifier and Type | Field and Description |
---|---|
protected StrictInstructionList |
mySubroutineList |
protected java.lang.String |
mySubroutineName |
gelementsToValue, subroutineNames
Constructor and Description |
---|
Subroutine(java.lang.String subroutineName)
Construct an Assignment instruction from a variable and an expression,
e.g., X = expression.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
evaluate(Context c)
Evaluate the expression that's part of this instruction and update a
global map/store to record the assignment of the expression to the
variable.
|
java.lang.String |
toString()
Returns a String for this instruction.
|
protected java.lang.String mySubroutineName
protected StrictInstructionList mySubroutineList
public Subroutine(java.lang.String subroutineName)
e
- expression being assignedv
- variable to which the expression is assignedpublic java.lang.Object evaluate(Context c)
evaluate
in class Instruction
c
- is the Context in which the evaluation takes placepublic java.lang.String toString()
toString
in class java.lang.Object