Moved from stack to inline execution.

git-svn-id: svn://10.0.0.236/trunk@33132 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
rogerl%netscape.com
1999-05-28 19:00:48 +00:00
parent 734272ce20
commit 7448fc1fe9
23 changed files with 279 additions and 396 deletions

View File

@@ -5,28 +5,29 @@ class ArithmeticNode extends BinaryNode {
super(aOp, aLeft, aRight);
}
void eval(Environment theEnv)
JSValue eval(Environment theEnv)
{
left.eval(theEnv);
JSValue lV = theEnv.theStack.pop();
right.eval(theEnv);
JSValue lV = left.eval(theEnv);
JSValue rV = right.eval(theEnv);
if (op == "+")
lV.add(theEnv);
return lV.add(theEnv, rV);
else
if (op == "-")
lV.subtract(theEnv);
return lV.subtract(theEnv, rV);
else
if (op == "*")
lV.multiply(theEnv);
return lV.multiply(theEnv, rV);
else
if (op == "/")
lV.divide(theEnv);
return lV.divide(theEnv, rV);
else
if (op == "%")
lV.remainder(theEnv);
else
return lV.remainder(theEnv, rV);
else {
System.out.println("missing arithmetic op " + op);
return null;
}
}
}