Mozilla/mozilla/js/js2/java/BitwiseNode.java
rogerl%netscape.com 095914ec44 Switching to JSValue throughout. Implementing operators per base type.
git-svn-id: svn://10.0.0.236/trunk@32415 18797224-902f-48f8-a5cc-f745e15eee43
1999-05-20 21:16:11 +00:00

36 lines
774 B
Java

class BitwiseNode extends BinaryNode {
BitwiseNode(String aOp, ExpressionNode aLeft, ExpressionNode aRight)
{
super(aOp, aLeft, aRight);
}
void eval(Environment theEnv)
{
left.eval(theEnv);
JSInteger lV = theEnv.theStack.pop().toJSInteger();
right.eval(theEnv);
if (op == "&")
lV.and(theEnv);
else
if (op == "|")
lV.or(theEnv);
else
if (op == "^")
lV.xor(theEnv);
else
if (op == "<<")
lV.shr(theEnv);
else
if (op == ">>")
lV.shl(theEnv);
else
if (op == ">>>")
lV.ushl(theEnv);
else
System.out.println("missing bitwise op " + op);
}
}