Revision: 2340
          http://vexi.svn.sourceforge.net/vexi/?rev=2340&view=rev
Author:   mkpg2
Date:     2007-09-27 08:22:38 -0700 (Thu, 27 Sep 2007)

Log Message:
-----------
Small improvements to error messages. 
Split on with no args returns array. 

Modified Paths:
--------------
    trunk/core/org.ibex.js/src/org/ibex/js/JS.jpp
    trunk/core/org.ibex.js/src/org/ibex/js/JSArray.jpp
    trunk/core/org.ibex.js/src/org/ibex/js/JSPrimitive.jpp

Modified: trunk/core/org.ibex.js/src/org/ibex/js/JS.jpp
===================================================================
--- trunk/core/org.ibex.js/src/org/ibex/js/JS.jpp       2007-09-27 15:20:14 UTC 
(rev 2339)
+++ trunk/core/org.ibex.js/src/org/ibex/js/JS.jpp       2007-09-27 15:22:38 UTC 
(rev 2340)
@@ -366,11 +366,12 @@
     public static abstract class Keys extends Immutable {
        JS keysof;
        public Keys(JS keysof){this.keysof = keysof;}
-       protected JS contains(JS key) throws JSExn{ throw new JSExn("Cannot 
call contains on keysof [" + keysof.getClass().getSimpleName() +"]");}
-       public Enumeration iterator() throws JSExn{throw new JSExn("Cannot 
iterate over [" +keysof.getClass().getSimpleName() +"]");}
-       protected JS remove(JS key) throws JSExn{ throw new JSExn("Cannot 
remove key from [" + keysof.getClass().getSimpleName() +"]");}
-       protected JS size() throws JSExn{ throw new JSExn("Cannot call size on 
keysof [" + getClass().getName() +"]");}
-       
+       protected JS contains(JS key) throws JSExn{ throw new JSExn("Cannot 
call contains on keysof "  + name());}
+       public Enumeration iterator() throws JSExn{throw new JSExn("Cannot 
iterate over "  + name());}
+       protected JS remove(JS key) throws JSExn{ throw new JSExn("Cannot 
remove key from " + name());}
+       protected JS size() throws JSExn{ throw new JSExn("Cannot call size on 
keysof " + name());}
+       private JS name() throws JSExn{ throw new JSExn(type()+ " [" + 
keysof.getClass().getName() +"]");}
+
         public JS get(JS key) throws JSExn {
             //#switch(JSU.toString(key))
             case "contains": return METHOD; 

Modified: trunk/core/org.ibex.js/src/org/ibex/js/JSArray.jpp
===================================================================
--- trunk/core/org.ibex.js/src/org/ibex/js/JSArray.jpp  2007-09-27 15:20:14 UTC 
(rev 2339)
+++ trunk/core/org.ibex.js/src/org/ibex/js/JSArray.jpp  2007-09-27 15:22:38 UTC 
(rev 2340)
@@ -28,12 +28,7 @@
                            public JS _next() { return JSU.N(n++); }
                        };
                        }
-                       protected JS remove(JS key) throws JSExn {
-                           throw new JSExn("attempted to remove key from an 
array(!)");
-                       }
-                       protected JS size() throws JSExn {
-                               return JSU.N(JSArray.this.size());
-                       }
+                       protected JS size() throws JSExn {return 
JSU.N(JSArray.this.size());}
         };
        
     }

Modified: trunk/core/org.ibex.js/src/org/ibex/js/JSPrimitive.jpp
===================================================================
--- trunk/core/org.ibex.js/src/org/ibex/js/JSPrimitive.jpp      2007-09-27 
15:20:14 UTC (rev 2339)
+++ trunk/core/org.ibex.js/src/org/ibex/js/JSPrimitive.jpp      2007-09-27 
15:22:38 UTC (rev 2340)
@@ -56,7 +56,9 @@
             if (a > b) return SC_;
             return JSU.S(s.substring(a,b));
         }
-        case "split": return 
JSRegexp.stringSplit(this,args[0],args.length>1?args[1]:null);
+        case "split":
+               if(args.length==0) return new JSArray(this);
+               return 
JSRegexp.stringSplit(this,args[0],args.length>1?args[1]:null);
         case "substr": {
             int start = args.length >= 1 ? JSU.toInt(args[0]) : 0;
             int len = args.length >= 2 ? JSU.toInt(args[1]) : 
Integer.MAX_VALUE;


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Vexi-svn mailing list
Vexi-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to