js/src/jit-test/tests/arguments/defaults-basic.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.)

michael@0 1 function f1(a, bIs, b=3) {
michael@0 2 assertEq(a, 1);
michael@0 3 assertEq(b, bIs);
michael@0 4 }
michael@0 5 assertEq(f1.length, 2);
michael@0 6 f1(1, 3);
michael@0 7 f1(1, 42, 42);
michael@0 8 f1(1, 3, undefined);
michael@0 9 function f2(a, bIs, cIs, b=3, c=4) {
michael@0 10 assertEq(a, 1);
michael@0 11 assertEq(b, bIs);
michael@0 12 assertEq(c, cIs);
michael@0 13 }
michael@0 14 assertEq(f2.length, 3);
michael@0 15 f2(1, 3, 4);
michael@0 16 f2(1, 42, 4, 42);
michael@0 17 f2(1, 42, 43, 42, 43);
michael@0 18 f2(1, 3, 4, undefined);
michael@0 19 f2(1, 42, 4, 42, undefined);
michael@0 20 f2(1, 3, 42, undefined, 42);
michael@0 21 function f3(a, b, c=4) {
michael@0 22 assertEq(a, 1);
michael@0 23 assertEq(b, undefined);
michael@0 24 assertEq(c, 4);
michael@0 25 }
michael@0 26 f3(1);
michael@0 27 function f4(a, bIs, cIs, b=3, c) {
michael@0 28 assertEq(a, 1);
michael@0 29 assertEq(b, bIs);
michael@0 30 assertEq(c, cIs);
michael@0 31 }
michael@0 32 assertEq(f4.length, 3);
michael@0 33 f4(1, 3, undefined);
michael@0 34 f4(1, 4, undefined, 4);
michael@0 35 f4(1, 4, 5, 4, 5);

mercurial