New.
git-svn-id: svn://10.0.0.236/trunk@32351 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
34
mozilla/js/js2/java/BitwiseNode.java
Normal file
34
mozilla/js/js2/java/BitwiseNode.java
Normal file
@@ -0,0 +1,34 @@
|
||||
class BitwiseNode extends BinaryNode {
|
||||
|
||||
BitwiseNode(String aOp, ExpressionNode aLeft, ExpressionNode aRight)
|
||||
{
|
||||
super(aOp, aLeft, aRight);
|
||||
}
|
||||
|
||||
void eval(Environment theEnv)
|
||||
{
|
||||
super.eval(theEnv);
|
||||
int iR = (int)(theEnv.theStack.pop().d);
|
||||
int iL = (int)(theEnv.theStack.pop().d);
|
||||
if (op == "&")
|
||||
theEnv.theStack.push(new StackValue(iL & iR));
|
||||
else
|
||||
if (op == "|")
|
||||
theEnv.theStack.push(new StackValue(iL | iR));
|
||||
else
|
||||
if (op == "^")
|
||||
theEnv.theStack.push(new StackValue(iL ^ iR));
|
||||
else
|
||||
if (op == "<<")
|
||||
theEnv.theStack.push(new StackValue(iL << iR));
|
||||
else
|
||||
if (op == ">>")
|
||||
theEnv.theStack.push(new StackValue(iL >> iR));
|
||||
else
|
||||
if (op == ">>>")
|
||||
theEnv.theStack.push(new StackValue(iL >>> iR));
|
||||
else
|
||||
System.out.println("missing bitwise op " + op);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user