2003/11/05 06:22:10
[org.ibex.core.git] / src / org / xwt / js / Regexp.java
index 8179123..834a425 100644 (file)
@@ -7,9 +7,7 @@ public class Regexp extends JS.Obj {
     private RE re;
     private int lastIndex;
     
-    public Regexp(JS.Array args) throws JS.Exn {
-        if(args.length() < 1) throw new JS.Exn("Not enough args to regexp");
-        Object arg0 = args.elementAt(0);
+    public Regexp(Object arg0, Object arg1) throws JS.Exn {
         if(arg0 instanceof Regexp) {
             Regexp r = (Regexp) arg0;
             this.global = r.global;
@@ -19,7 +17,7 @@ public class Regexp extends JS.Obj {
             String pattern = arg0.toString();
             String sFlags = null;
             int flags = 0;
-            if(args.length() == 2) sFlags = args.elementAt(1).toString();
+            if(arg1 != null) sFlags = (String)arg1;
             if(sFlags == null) sFlags = "";
             for(int i=0;i<sFlags.length();i++) {
                 switch(sFlags.charAt(i)) {