2003/09/24 07:33:32
[org.ibex.core.git] / src / org / xwt / js / Regexp.java
index dd77580..18c6aeb 100644 (file)
@@ -35,13 +35,21 @@ public class Regexp extends JS.Obj {
             _put("ignoreCase",wrapBool(flags & RE.REG_ICASE));
             _put("multiline",wrapBool(flags & RE.REG_MULTILINE));
         }
-        // FIXME: Do whatever we need to do to take advantage of the GETCALL bytecode when its available
-        final JS.Callable execFN = new JS.Callable() { public Object call(JS.Array args) { return exec(args); } };
-        final JS.Callable testFN = new JS.Callable() { public Object call(JS.Array args) { return test(args); } };
-        final JS.Callable toStringFN = new JS.Callable() { public Object call(JS.Array args) { return Regexp.this.toString(); } };
-        _put("exec",execFN);
-        _put("test",testFN);
-        _put("toString",toStringFN);
+    }
+
+    public Object callMethod(Object method, Array args, boolean checkOnly) throws JS.Exn {
+        if (method.equals("exec")) {
+            if (checkOnly) return Boolean.TRUE;
+            return exec(args);
+        } else if (method.equals("test")) {
+            if (checkOnly) return Boolean.TRUE;
+            return test(args);
+        } else if (method.equals("toString")) {
+            if (checkOnly) return Boolean.TRUE;
+            return toString();
+        }
+        if (checkOnly) return Boolean.FALSE;
+        return null;
     }
     
     // gcj bug...