move to JS interface
[org.ibex.js.git] / src / org / ibex / js / JSPrimitive.java
index 4419655..4d6bcba 100644 (file)
@@ -4,9 +4,11 @@
 
 package org.ibex.js;
 
-class JSPrimitive extends JS {
-    public JS callMethod(JS method, JS arg0, JS arg1, JS arg2, JS[] rest, int alength) throws JSExn {
-        //#switch(JS.toString(method))
+class JSPrimitive extends JS.Immutable {
+    private static final JS.Method METHOD = new JS.Method();
+
+    public JS callMethod(JS method, JS[] args) throws JSExn {
+        //#switch(Script.str(method))
         case "toFixed": throw new JSExn("toFixed() not implemented");
         case "toExponential": throw new JSExn("toExponential() not implemented");
         case "toPrecision": throw new JSExn("toPrecision() not implemented");
@@ -49,8 +51,8 @@ class JSPrimitive extends JS {
         }
         case "concat": {
             StringBuffer sb = new StringBuffer(slength*2).append(s);
-            for(int i=0;i<alength;i++) sb.append(i==0?arg0:i==1?arg1:i==2?arg2:rest[i-3]);
-            return JS.S(sb.toString());
+            for (int i=0; i < args.length; i++) sb.append(args[i]);
+            return Script.S(sb.toString());
         }
         case "indexOf": {
             String search = alength >= 1 ? JS.toString(arg0) : "null";
@@ -83,7 +85,7 @@ class JSPrimitive extends JS {
             return JS.S(s.substring(a,b));
         }
         //#end
-        return super.callMethod(method,arg0,arg1,arg2,rest,alength);
+        return super.call(method, args);
     }
     
     public JS get(JS key) throws JSExn {