Subj : Rhino 1.5R4_1 problem with try/catch, WITH, GETBASE To : netscape.public.mozilla.jseng From : Laura Werner Date : Mon Jun 09 2003 12:16 pm Hi all, I'm having a weird Rhino problem that I don't understand, and I'm hoping someone here can help. First some background: I have Rhino embedded in our (BeVocal's) VoiceXML interpreter. I create my own ScriptableObject implementation that I use as the global scope. Each time a new VoiceXML scope is entered, I create a new ScriptableObject to use as that scope, and set its parent scope to the previous scope on my stack, then push the new one. The problem I'm having is related to a function A that calls B that calls C. Function A has a try/catch block in it. In IRFactory.createTryCatchFinally, the interpreter creates a "with" block inside the catch. Later, NodeTransfer.transform notices the WITH node and calls "setRequiresActivation(true)" on the function containing the try/catch. At execution time, Interpreter.interpret for function A notices the itsNeedsActivation flag and sets "calleeScope" to the result of ScriptableObject.getTopLevelScope on the scope being executed. This walks up the parent scope chain and ends up getting the global scope that was created by our VXML interpreter. So far so good. Now, function A calls function B, passing in calleeScope (the global scope) as its execution-time scope. B now tries to call C, and interpret() encounters a GETBASE node. This tries to look up "C" in the execution scope (which is the global scope now) and fails because C isn't defined in the global scope; it's in the script's scope. I have a few questions: a) Does what I described here make any sense? b) Why does WITH trigger a setRequiresActivation(true) on the function containing it? I haven't messed with Rhino innards enough to know yet. c) Does this issue look like a Rhino bug? d) Or am I doing something wrong? When I'm executing a script, do I need to make that script be the global scope? Thanks! Laura Werner BeVocal, Inc. .