2003/06/29 21:20:38
[org.ibex.core.git] / src / org / xwt / js / JS.java
index 9cd65ee..48eb61b 100644 (file)
@@ -139,13 +139,13 @@ public abstract class JS {
 
         CompiledFunction currentCompiledFunction = null;
         Vec stack = new Vec();
-        int line = -1;
+        int pc;
 
         /** binds this thread to the current Java Thread */
         public void bindToCurrentJavaThread() { javaThreadToJSThread.put(java.lang.Thread.currentThread(), this); }
 
         /** returns the line of code that is currently executing */
-        public int getLine() { return line; }
+        public int getLine() { return currentCompiledFunction == null ? -1 : currentCompiledFunction.getLine(pc); }
 
         /** returns the name of the source code file which declared the currently executing function */
         public String getSourceName() { return currentCompiledFunction == null ? null : currentCompiledFunction.getSourceName();  }
@@ -168,6 +168,9 @@ public abstract class JS {
             return ret;
         }
         
+        public static JS.Thread currentJSThread() {
+            return fromJavaThread(java.lang.Thread.currentThread());
+        }
     }
 }