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 BitwiseNode extends BinaryNode {
void eval(Environment theEnv)
{
super.eval(theEnv);
int iR = (int)(theEnv.theStack.pop().d);
int iL = (int)(theEnv.theStack.pop().d);
left.eval(theEnv);
JSInteger lV = theEnv.theStack.pop().toJSInteger();
right.eval(theEnv);
if (op == "&")
theEnv.theStack.push(new StackValue(iL & iR));
lV.and(theEnv);
else
if (op == "|")
theEnv.theStack.push(new StackValue(iL | iR));
lV.or(theEnv);
else
if (op == "^")
theEnv.theStack.push(new StackValue(iL ^ iR));
lV.xor(theEnv);
else
if (op == "<<")
theEnv.theStack.push(new StackValue(iL << iR));
lV.shr(theEnv);
else
if (op == ">>")
theEnv.theStack.push(new StackValue(iL >> iR));
lV.shl(theEnv);
else
if (op == ">>>")
theEnv.theStack.push(new StackValue(iL >>> iR));
lV.ushl(theEnv);
else
System.out.println("missing bitwise op " + op);
}