Mucking about with stuff.

git-svn-id: svn://10.0.0.236/trunk@34891 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
rogerl%netscape.com
1999-06-11 23:05:16 +00:00
parent c94bac5a24
commit e7d38e04ed
5 changed files with 27 additions and 13 deletions

View File

@@ -3,11 +3,12 @@ import java.util.Hashtable;
class JSObject extends JSValue {
static JSObject JSUndefined = new JSObject("undefined");
static JSObject JSUndefined = new JSObject("undefined", null);
JSObject(String aValue)
JSObject(String aValue, JSObject aPrototype)
{
value = aValue;
prototype = aPrototype;
}
String print(String indent)
@@ -38,9 +39,17 @@ class JSObject extends JSValue {
JSDouble toJSDouble(Environment theEnv) {
return toPrimitive(theEnv, "Number").toJSDouble(theEnv);
}
JSValue getProp(Environment theEnv, JSString id) {
return (JSValue)(contents.get(id.s));
JSValue getProp(Environment theEnv, JSString id)
{
Object v = contents.get(id.s);
if (v == null)
if (prototype == null)
return JSUndefined;
else
return prototype.getProp(theEnv, id);
else
return (JSValue)v;
}
JSValue putProp(Environment theEnv, JSString id, JSValue rV) {
@@ -53,4 +62,5 @@ class JSObject extends JSValue {
String value;
JSObject prototype;
}