Changes to get traditional functions with args. working

git-svn-id: svn://10.0.0.236/trunk@35302 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
rogerl%netscape.com
1999-06-15 00:57:05 +00:00
parent 26c8590a2b
commit b5540991c3
10 changed files with 111 additions and 23 deletions

View File

@@ -3,21 +3,27 @@ import java.util.Hashtable;
class JSObject extends JSValue {
static JSObject JSUndefined = new JSObject("undefined", null);
static JSObject objectPrototype = new JSObject("Object");
static JSObject JSUndefined = new JSObject("undefined");
JSObject(String aValue, JSObject aPrototype)
JSObject(String aClass)
{
oClass = aClass;
prototype = objectPrototype;
}
void setPrototype(JSObject aPrototype)
{
value = aValue;
prototype = aPrototype;
}
String print(String indent)
{
return indent + "JSObject : " + value + "\n";
return indent + "JSObject : " + oClass + "\n";
}
public String toString() {
return value + contents.toString();
return oClass + contents.toString();
}
JSValue eval(Environment theEnv)
@@ -52,6 +58,18 @@ class JSObject extends JSValue {
return (JSValue)v;
}
boolean hasProp(Environment theEnv, JSString id)
{
Object v = contents.get(id.s);
if (v == null)
if (prototype == null)
return false;
else
return prototype.hasProp(theEnv, id);
else
return true;
}
JSValue putProp(Environment theEnv, JSString id, JSValue rV) {
contents.put(id.s, rV);
return rV;
@@ -60,7 +78,7 @@ class JSObject extends JSValue {
Hashtable contents = new Hashtable();
String value;
String oClass;
JSObject prototype;
}