Mozilla/mozilla/js/js2/java/JSObject.java
rogerl%netscape.com a58c620f15 New.
git-svn-id: svn://10.0.0.236/trunk@32351 18797224-902f-48f8-a5cc-f745e15eee43
1999-05-20 00:14:26 +00:00

40 lines
955 B
Java

class JSObject extends JSValue {
JSObject(String aType, String aValue)
{
type = aType;
value = aValue;
}
String print(String indent)
{
return indent + "JSObject " + type + " : " + value + "\n";
}
void evalLHS(Environment theEnv)
{
if (type == "object") {
theEnv.theStack.push(new StackValue(value));
}
else {
System.out.println("EvalLHS on non-object");
}
}
void eval(Environment theEnv)
{
if (type.equals("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()));
}
}
String type;
String value;
}