fix vexi.string
[org.ibex.core.git] / src / org / ibex / core / Ibex.java
index 2b8c7aa..0a48c5f 100644 (file)
@@ -241,36 +241,59 @@ public final class Ibex extends JS.Cloneable {
     }
     
     public static final JSMath ibexMath = new JSMath() {
+            // FEATURE: find a cleaner way to do this
             private JS gs = new JSScope.Global();
             public Object get(Object key) throws JSExn {
                 //#switch(key)
-                case "isNaN": return gs.get("isNaN");
-                case "isFinite": return gs.get("isFinite");
-                case "NaN": return gs.get("NaN");
-                case "Infinity": return gs.get("Infinity");
+                case "isNaN": return METHOD;
+                case "isFinite": return METHOD;
+                case "NaN": return METHOD;
+                case "Infinity": return METHOD;
                 //#end
                 return super.get(key);
             }
-        };
+            public Object callMethod(Object name, Object a, Object b, Object c, Object[] rest, int nargs) throws JSExn {
+                //#switch(name)
+                case "isNaN": return gs.callMethod(name,a,b,c,rest,nargs);
+                case "isFinite": return gs.callMethod(name,a,b,c,rest,nargs);
+                case "NaN": return gs.callMethod(name,a,b,c,rest,nargs);
+                case "Infinity": return gs.callMethod(name,a,b,c,rest,nargs);
+                //#end
+                return super.callMethod(name,a,b,c,rest,nargs);
+            }
+    };
 
     public static final JS ibexString = new JS() {
             private JS gs = new JSScope.Global();
-            public void put(Object key, Object val) { }
             public Object get(Object key) throws JSExn {
                 //#switch(key)
-                case "parseInt": return gs.get("parseInt");
-                case "parseFloat": return gs.get("parseFloat");
-                case "decodeURI": return gs.get("decodeURI");
-                case "decodeURIComponent": return gs.get("decodeURIComponent");
-                case "encodeURI": return gs.get("encodeURI");
-                case "encodeURIComponent": return gs.get("encodeURIComponent");
-                case "escape": return gs.get("escape");
-                case "unescape": return gs.get("unescape");
-                case "fromCharCode": return gs.get("stringFromCharCode");
+                case "parseInt": return METHOD;
+                case "parseFloat": return METHOD;
+                case "decodeURI": return METHOD;
+                case "decodeURIComponent": return METHOD;
+                case "encodeURI": return METHOD;
+                case "encodeURIComponent": return METHOD;
+                case "escape": return METHOD;
+                case "unescape": return METHOD;
+                case "fromCharCode": return METHOD;
                 //#end
-                return null;
+                return super.get(key);
+            }
+            public Object callMethod(Object name, Object a, Object b, Object c, Object[] rest, int nargs) throws JSExn {
+                //#switch(name)
+                case "parseInt": return gs.callMethod(name,a,b,c,rest,nargs);
+                case "parseFloat": return gs.callMethod(name,a,b,c,rest,nargs);
+                case "decodeURI": return gs.callMethod(name,a,b,c,rest,nargs);
+                case "decodeURIComponent": return gs.callMethod(name,a,b,c,rest,nargs);
+                case "encodeURI": return gs.callMethod(name,a,b,c,rest,nargs);
+                case "encodeURIComponent": return gs.callMethod(name,a,b,c,rest,nargs);
+                case "escape": return gs.callMethod(name,a,b,c,rest,nargs);
+                case "unescape": return gs.callMethod(name,a,b,c,rest,nargs);
+                case "fromCharCode": return gs.callMethod(name,a,b,c,rest,nargs);
+                //#end
+                return super.callMethod(name,a,b,c,rest,nargs);
             }
-        };
+    };
 
     private class XMLHelper extends XML {
         private class Wrapper extends XML.Exn { public JSExn wrapee; public Wrapper(JSExn jse) { super(""); wrapee = jse; } }