2003/11/29 03:06:09
[org.ibex.core.git] / src / org / xwt / js / Interpreter.java
index 0a0b27b..66931fd 100644 (file)
@@ -32,7 +32,7 @@ class Interpreter implements ByteCodes, Tokens {
     }
     
     /** this is the only synchronization point we need in order to be threadsafe */
-    synchronized Object resume() {
+    synchronized Object resume() throws JSExn {
         Thread t = Thread.currentThread();
         Interpreter old = (Interpreter)threadToInterpreter.get(t);
         threadToInterpreter.put(t, this);
@@ -523,7 +523,7 @@ class Interpreter implements ByteCodes, Tokens {
 
     // Operations on Primitives //////////////////////////////////////////////////////////////////////
 
-    static Object callMethodOnPrimitive(Object o, Object method, Object arg0, Object arg1, Object arg2, Object[] rest, int alength) {
+    static Object callMethodOnPrimitive(Object o, Object method, Object arg0, Object arg1, Object arg2, Object[] rest, int alength) throws JSExn {
         if (o instanceof Number) {
             //#switch(method)
             case "toFixed": throw new JSExn("toFixed() not implemented");
@@ -612,7 +612,7 @@ class Interpreter implements ByteCodes, Tokens {
         throw new JSExn("Attempted to call non-existent method: " + method);
     }
     
-    static Object getFromPrimitive(Object o, Object key) {
+    static Object getFromPrimitive(Object o, Object key) throws JSExn {
         boolean returnJS = false;
         if (o instanceof Boolean) {
             throw new JSExn("cannot call methods on Booleans");
@@ -643,14 +643,14 @@ class Interpreter implements ByteCodes, Tokens {
             case "toLowerCase": returnJS = true; break; 
             case "toUpperCase": returnJS = true; break; 
             case "toString": returnJS = true; break; 
-            case "substr": returnJS = true; break; 
-            //#end
+            case "substr": returnJS = true; break;  
+           //#end
         }
         if (returnJS) {
             final Object target = o;
             final String method = key.toString();
             return new JS() {
-                    public Object call(Object a0, Object a1, Object a2, Object[] rest, int nargs) {
+                    public Object call(Object a0, Object a1, Object a2, Object[] rest, int nargs) throws JSExn {
                         if (nargs > 2) throw new JSExn("cannot call that method with that many arguments");
                         return callMethodOnPrimitive(target, method, a0, a1, a2, rest, nargs);
                     }
@@ -663,7 +663,7 @@ class Interpreter implements ByteCodes, Tokens {
         private Object method;
         JS obj;
         public Stub(JS obj, Object method) { this.obj = obj; this.method = method; }
-        public Object call(Object a0, Object a1, Object a2, Object[] rest, int nargs) {
+        public Object call(Object a0, Object a1, Object a2, Object[] rest, int nargs) throws JSExn {
             return ((JS)obj).callMethod(method, a0, a1, a2, rest, nargs);
         }
     }