2003/06/16 06:24:31
[org.ibex.core.git] / src / org / xwt / js / CompiledFunction.java
index cddaeca..ac14075 100644 (file)
@@ -90,6 +90,7 @@ public final class CompiledFunction extends JS.Callable implements ByteCodes, To
 
     // Adding and Altering Bytecodes ///////////////////////////////////////////////////
 
+    int get(int pos) { return op[pos]; }
     void set(int pos, int op_, Object arg_) { op[pos] = op_; arg[pos] = arg_; }
     void set(int pos, Object arg_) { arg[pos] = arg_; }
     void paste(CompiledFunction other) { for(int i=0; i<other.size; i++) add(other.line[i], other.op[i], other.arg[i]); }
@@ -192,7 +193,7 @@ public final class CompiledFunction extends JS.Callable implements ByteCodes, To
                throw new Error("CONTINUE/BREAK invoked but couldn't find a LoopMarker at " + sourceName + ":" + line);
 
             case TRY: {
-               t.push(new Context.TryMarker(pc + ((Integer)arg[pc]).intValue()));
+               t.push(new Context.TryMarker(pc + ((Integer)arg[pc]).intValue(), s));
                break;
            }
 
@@ -253,7 +254,6 @@ public final class CompiledFunction extends JS.Callable implements ByteCodes, To
                 int numArgs = JS.toNumber(arg[pc]).intValue();
                 arguments.setSize(numArgs);
                 for(int j=numArgs - 1; j >= 0; j--) arguments.setElementAt(t.pop(), j);
-               // FIXME: we really need to distinguish between compiled functions and callables
                 JS.Callable f = (JS.Callable)t.pop();
                 if (f == null) throw je("attempted to call null");
                try {
@@ -271,6 +271,7 @@ public final class CompiledFunction extends JS.Callable implements ByteCodes, To
                    if (o instanceof Context.TryMarker) {
                        t.push(exn);
                        pc = ((Context.TryMarker)o).location - 1;
+                       s = ((Context.TryMarker)o).scope;
                        continue OUTER;
                    }
                }