mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-05 16:46:26 +00:00
36 lines
842 B
Java
36 lines
842 B
Java
class RelationalNode extends BinaryNode {
|
|
|
|
RelationalNode(String aOp, ExpressionNode aLeft, ExpressionNode aRight)
|
|
{
|
|
super(aOp, aLeft, aRight);
|
|
}
|
|
|
|
JSValue eval(Environment theEnv)
|
|
{
|
|
JSValue lV = left.eval(theEnv);
|
|
JSValue rV = right.eval(theEnv);
|
|
|
|
if (op == ">")
|
|
return lV.gt(theEnv, rV);
|
|
else
|
|
if (op == ">=")
|
|
return lV.ge(theEnv, rV);
|
|
else
|
|
if (op == "<")
|
|
return lV.lt(theEnv, rV);
|
|
else
|
|
if (op == "<=")
|
|
return lV.le(theEnv, rV);
|
|
else
|
|
if (op == "==")
|
|
return lV.eq(theEnv, rV);
|
|
else
|
|
if (op == "!=")
|
|
return lV.ne(theEnv, rV);
|
|
else {
|
|
System.out.println("missing relational op");
|
|
return null;
|
|
}
|
|
}
|
|
}
|