fix JSPrimitive bug that broke methods on JSStrings
authoradam <adam@megacz.com>
Tue, 11 Jan 2005 08:12:20 +0000 (08:12 +0000)
committeradam <adam@megacz.com>
Tue, 11 Jan 2005 08:12:20 +0000 (08:12 +0000)
darcs-hash:20050111081220-5007d-ec2ad0cb4a739a1175e93c86b902e7e2a6c54950.gz

src/org/ibex/js/JSPrimitive.java

index 57f9c9e..e011453 100644 (file)
@@ -7,18 +7,15 @@ package org.ibex.js;
 class JSPrimitive extends JS.Immutable {
     private static final JS.Method METHOD = new JS.Method();
 
-    public JS callMethod(JS method, JS[] args) throws JSExn {
+    public JS call(JS method, JS[] args) throws JSExn {
+        String s = coerceToString();
+        int slength = s.length();
+
         //#switch(JSU.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");
         case "toString": return this instanceof JSString ? this : JSU.S(JSU.toString(this));
-        //#end
-            
-        String s = coerceToString();
-        int slength = s.length();
-            
-        //#switch(JSU.toString(method))
         case "substring": {
             int a = args.length >= 1 ? JSU.toInt(args[0]) : 0;
             int b = args.length >= 2 ? JSU.toInt(args[1]) : slength;