js/src/jit-test/tests/arguments/defaults-with-rest.js

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     1 load(libdir + "eqArrayHelper.js");
     3 function f1(a, bIs, b=3, ...rest) {
     4     assertEq(a, 1);
     5     assertEq(bIs, b);
     6     assertEqArray(rest, []);
     7 }
     8 assertEq(f1.length, 2);
     9 f1(1, 3);
    10 f1(1, 42, 42);
    11 function f2(a=rest, ...rest) {
    12     assertEq(a, undefined);
    13 }
    14 f2();
    15 function f3(a=rest, ...rest) {
    16     assertEq(a, 1);
    17     assertEqArray(rest, [2, 3, 4]);
    18 }
    19 f3(1, 2, 3, 4);
    20 function f4(a=42, ...f)  {
    21     assertEq(typeof f, "function");
    22     function f() {}
    23 }
    24 f4()

mercurial