Subj : Activation in Rhino To : netscape.public.mozilla.jseng From : bergan@cs.stanford.edu (Jeff Bergan) Date : Mon Jun 02 2003 12:53 pm Hi, I seem to be having a problem with the following lines in Interpreter: if (idata.itsNeedsActivation) { calleeScope = ScriptableObject.getTopLevelScope(scope); } My problem is that in my integration with Rhino, the scope I'm using has multiple parent scopes, as opposed to the direct parent being the global scope. Thus, the getTopLevelScope traverses the parent chain farther than it should, to end up with the top-most parent. Thus, if I execute a script that has two functions: var variable = 1; function bar() { return variable; } function foo() { eval("1+2"); return bar(); } And then another script calls foo(), I get different behavior depending on whether the eval("1+2") is commented out. If the eval("1+2") is commented out, everything works fine. If it is there, then foo's "itsNeedsActivation" variable is set to true, and thus the scope handed to bar is incorrect (and doesn't contain "variable"). It seems to me that if the getTopLevelScope call is just trying to get rid of the NativeCall object then it can be replaced by getting the parent scope of "scope". Would that be sufficient? As a side question, if foo and bar were declared at different scope levels, shouldn't the CALL token pass the scope in which bar() was declared as its scope rather than the scope that was passed into foo()? Thanks, Jeff .