added new invocation that does not create a call frame
[org.ibex.js.git] / src / org / ibex / js / Interpreter.java
index 504bbd2..94ccab5 100644 (file)
@@ -22,11 +22,12 @@ class Interpreter implements ByteCodes, Tokens {
     Vec stack = new Vec();        ///< the object stack
     int pc = 0;                   ///< the program counter
 
-    Interpreter(JSFunction f, boolean pauseable, JSArray args) {
+    Interpreter(JSFunction f, boolean pauseable, JSArray args) { this(f, pauseable, args, true); }
+    Interpreter(JSFunction f, boolean pauseable, JSArray args, boolean wrap) {
         stack.push(new Interpreter.CallMarker(this));    // the "root function returned" marker -- f==null
         this.f = f;
         this.pausecount = pauseable ? 0 : -1;
-        this.scope = new JSScope(f.parentScope);
+        this.scope = wrap ? new JSScope(f.parentScope) : f.parentScope;
         stack.push(args);
     }