minor bug fixes from moving interfaces
[org.ibex.js.git] / src / org / ibex / js / JSRegexp.java
index 40afb01..3353b1d 100644 (file)
@@ -48,7 +48,7 @@ public class JSRegexp extends JS.Immutable {
             case 1: {
                 //#switch(Script.str(method))
                 case "exec": {
-                    String s = Script.toString(a0);
+                    String s = Script.toString(args[0]);
                     int start = global ? lastIndex : 0;
                     if(start < 0 || start >= s.length()) { lastIndex = 0; return null; }
                     GnuRegexp.REMatch match = re.getMatch(s,start);
@@ -56,13 +56,13 @@ public class JSRegexp extends JS.Immutable {
                     return match == null ? null : matchToExecResult(match,re,s);
                 }
                 case "test": {
-                    String s = Script.toString(a0);
-                    if (!global) return B(re.getMatch(s) != null);
+                    String s = Script.toString(args[0]);
+                    if (!global) return Script.B(re.getMatch(s) != null);
                     int start = global ? lastIndex : 0;
                     if(start < 0 || start >= s.length()) { lastIndex = 0; return null; }
                     GnuRegexp.REMatch match = re.getMatch(s,start);
                     lastIndex = match != null ? s.length() : match.getEndIndex();
-                    return B(match != null);
+                    return Script.B(match != null);
                 }
                 case "toString": return Script.S(args[0].coerceToString());
                 //#end
@@ -299,7 +299,7 @@ public class JSRegexp extends JS.Immutable {
         if(sep != null && sep.length()==0) {
             int len = s.length();
             for(int i=0;i<len;i++)
-                ret.addElement(Script.S(s.substring(i,i+1)));
+                ret.add(Script.S(s.substring(i,i+1)));
             return ret;
         }
         
@@ -308,24 +308,24 @@ public class JSRegexp extends JS.Immutable {
                 GnuRegexp.REMatch m = re.getMatch(s,p);
                 if(m == null) break OUTER;
                 boolean zeroLength = m.getStartIndex() == m.getEndIndex();
-                ret.addElement(Script.S(s.substring(p,zeroLength ? m.getStartIndex()+1 : m.getStartIndex())));
+                ret.add(Script.S(s.substring(p,zeroLength ? m.getStartIndex()+1 : m.getStartIndex())));
                 p = zeroLength ? p + 1 : m.getEndIndex();
                 if(!zeroLength) {
                     for(int i=1;i<=re.getNumSubs();i++) {
-                        ret.addElement(Script.S(m.toString(i)));
-                        if(ret.length() == limit) break OUTER;
+                        ret.add(Script.S(m.toString(i)));
+                        if(ret.size() == limit) break OUTER;
                     }
                 }
             } else {
                 int x = s.indexOf(sep,p);
                 if(x == -1) break OUTER;
-                ret.addElement(Script.S(s.substring(p,x)));
+                ret.add(Script.S(s.substring(p,x)));
                 p = x + sep.length();
             }
-            if(ret.length() == limit) break;
+            if(ret.size() == limit) break;
         }
-        if(p < s.length() && ret.length() != limit)
-            ret.addElement(Script.S(s.substring(p)));
+        if(p < s.length() && ret.size() != limit)
+            ret.add(Script.S(s.substring(p)));
         return ret;
     }