2004/01/07 20:37:33
[org.ibex.core.git] / src / org / xwt / js / JSRegexp.java
index 3bb5ab9..0994a36 100644 (file)
@@ -153,7 +153,7 @@ public class JSRegexp extends JS {
     public static Object stringReplace(Object o, Object arg0, Object arg1) throws JSExn {
         String s = o.toString();
         RE re;
-        JS replaceFunc = null;
+        JSFunction replaceFunc = null;
         String replaceString = null;
         JSRegexp regexp = null;
         if(arg0 instanceof JSRegexp) {
@@ -162,10 +162,10 @@ public class JSRegexp extends JS {
         } else {
             re = newRE(arg0.toString(),0);
         }
-        if(arg1 instanceof JS)
-            replaceFunc = (JS) arg1;
+        if(arg1 instanceof JSFunction)
+            replaceFunc = (JSFunction) arg1;
         else
-            replaceString = arg1.toString();
+            replaceString = JS.toString(arg1.toString());
         REMatch[] matches;
         if(regexp != null && regexp.global) {
             matches = re.getAllMatches(s);