Switch to new JSValue hierarchy.

Added logical/bitwise ops.


git-svn-id: svn://10.0.0.236/trunk@32350 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
rogerl%netscape.com
1999-05-20 00:13:38 +00:00
parent 59c0460b7f
commit 13a12a7a0e
5 changed files with 41 additions and 61 deletions

View File

@@ -1,48 +1,19 @@
class JSValue extends ExpressionNode {
JSValue(String aType, String aValue)
{
type = aType;
value = aValue;
}
String print(String indent)
{
return indent + "JSValue " + type + " : " + value + "\n";
return indent + "JSValue\n";
}
void evalLHS(Environment theEnv)
{
if (type == "object") {
// if (!theEnv.theGlobals.containsKey(value))
// theEnv.theGlobals.put(value, new Double(0.0));
theEnv.theStack.push(new StackValue(value));
}
else {
System.out.println("EvalLHS on non-object");
}
throw new RuntimeException("EvalLHS on non-lvalue");
}
void eval(Environment theEnv)
{
if (type == "object") {
Double d = (Double)(theEnv.theGlobals.get(value));
if (d == null) {
System.out.println("Accessed undefined : " + value);
theEnv.theStack.push(new StackValue(0.0));
}
else
theEnv.theStack.push(new StackValue(d.doubleValue()));
}
else {
if (type == "number") {
Double d = new Double(value);
theEnv.theStack.push(new StackValue(d.doubleValue()));
}
}
}
String type;
String value;
throw new RuntimeException("Eval on JSValue");
}
}