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

@@ -13,12 +13,26 @@ class JSName extends ExpressionNode {
JSReference evalLHS(Environment theEnv)
{
return new JSReference(theEnv.scope, id);
JSScope scope = theEnv.scope;
while (scope != null) {
if (scope.hasProp(theEnv, id))
return new JSReference(scope, id);
else
scope = scope.parent;
}
return new JSReference(theEnv.globalScope, id);
}
JSValue eval(Environment theEnv)
{
return theEnv.scope.getProp(theEnv, id);
JSScope scope = theEnv.scope;
while (scope != null) {
if (scope.hasProp(theEnv, id))
return scope.getProp(theEnv, id);
else
scope = scope.parent;
}
throw new JSException(new JSString(id.s + " undefined"));
}
JSIdentifier id;