_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...
private static Boolean wrapBool(int n) {
return wrapBool(n != 0);
}
+
+ public String typeName() { return "regexp"; }
}