2003/06/16 08:55:37
[org.ibex.core.git] / src / org / xwt / js / CompiledFunctionImpl.java
index 416cd94..9d61a0f 100644 (file)
@@ -17,6 +17,9 @@ class CompiledFunctionImpl extends JS.Callable implements ByteCodes, Tokens {
     /** the line numbers */
     private int[] line = new int[10];
 
+    /** the first line of this script */
+    private int firstLine = -1;
+
     /** the instructions */
     private int[] op = new int[10];
 
@@ -45,16 +48,12 @@ class CompiledFunctionImpl extends JS.Callable implements ByteCodes, Tokens {
         this.parentScope = parentScope;
         if (sourceCode == null) return;
         Parser p = new Parser(sourceCode, sourceName, firstLine);
-        try {
-            while(true) {
-                int s = size();
-                p.parseStatement(this, null);
-                if (s == size()) break;
-            }
-            add(-1, Tokens.RETURN);
-        } catch (Exception e) {
-            if (Log.on) Log.log(Parser.class, e);
+        while(true) {
+            int s = size();
+            p.parseStatement(this, null);
+            if (s == size()) break;
         }
+        add(-1, Tokens.RETURN);
     }
     
     public Object call(JS.Array args) throws JS.Exn { return call(args, new FunctionScope(sourceName, parentScope)); }
@@ -105,7 +104,7 @@ class CompiledFunctionImpl extends JS.Callable implements ByteCodes, Tokens {
         final Vec t = cx.stack;
         OUTER: for(pc=0; pc<size; pc++) {
             String label = null;
-            cx.line = line[op];
+            cx.line = line[pc];
             switch(op[pc]) {
             case LITERAL: t.push(arg[pc]); break;
             case OBJECT: t.push(new JS.Obj()); break;