The array needs to grow up to expectedSize, don't decrement it ReducedStack
authorJaroslav Tulach <jaroslav.tulach@apidesign.org>
Tue, 18 Feb 2014 21:43:55 +0100
branchReducedStack
changeset 1476dbfabad86e5c
parent 1474 3775fe162073
child 1477 b012365f8fb7
The array needs to grow up to expectedSize, don't decrement it
rt/emul/mini/src/main/java/org/apidesign/bck2brwsr/emul/lang/System.java
     1.1 --- a/rt/emul/mini/src/main/java/org/apidesign/bck2brwsr/emul/lang/System.java	Tue Feb 18 10:02:46 2014 +0100
     1.2 +++ b/rt/emul/mini/src/main/java/org/apidesign/bck2brwsr/emul/lang/System.java	Tue Feb 18 21:43:55 2014 +0100
     1.3 @@ -51,12 +51,12 @@
     1.4      }
     1.5  
     1.6      @JavaScriptBody(args = { "arr", "expectedSize" }, body = 
     1.7 -        "while (expectedSize-- > arr.length) { arr.push(0); }; return arr;"
     1.8 +        "while (expectedSize > arr.length) { arr.push(0); }; return arr;"
     1.9      )
    1.10      public static native byte[] expandArray(byte[] arr, int expectedSize);
    1.11  
    1.12      @JavaScriptBody(args = { "arr", "expectedSize" }, body = 
    1.13 -        "while (expectedSize-- > arr.length) { arr.push(0); }; return arr;"
    1.14 +        "while (expectedSize > arr.length) { arr.push(0); }; return arr;"
    1.15      )
    1.16      public static native char[] expandArray(char[] arr, int expectedSize);
    1.17