Switching to JSValue throughout. Implementing operators per base type.

git-svn-id: svn://10.0.0.236/trunk@32415 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
rogerl%netscape.com
1999-05-20 21:16:11 +00:00
parent faaa440343
commit 095914ec44
19 changed files with 298 additions and 125 deletions

View File

@@ -7,26 +7,27 @@ class RelationalNode extends BinaryNode {
void eval(Environment theEnv)
{
super.eval(theEnv);
double dR = theEnv.theStack.pop().d;
double dL = theEnv.theStack.pop().d;
left.eval(theEnv);
JSValue lV = theEnv.theStack.pop();
right.eval(theEnv);
if (op == ">")
theEnv.theStack.push(new StackValue((dL > dR) ? 1 : 0));
lV.gt(theEnv);
else
if (op == ">=")
theEnv.theStack.push(new StackValue((dL >= dR) ? 1 : 0));
lV.ge(theEnv);
else
if (op == "<")
theEnv.theStack.push(new StackValue((dL < dR) ? 1 : 0));
lV.lt(theEnv);
else
if (op == "<=")
theEnv.theStack.push(new StackValue((dL <= dR) ? 1 : 0));
lV.le(theEnv);
else
if (op == "==")
theEnv.theStack.push(new StackValue((dL == dR) ? 1 : 0));
lV.eq(theEnv);
else
if (op == "!=")
theEnv.theStack.push(new StackValue((dL != dR) ? 1 : 0));
lV.ne(theEnv);
else
System.out.println("missing relational op");
}