Fri, 16 Jan 2015 04:50:19 +0100
Replace accessor implementation with direct member state manipulation, by
request https://trac.torproject.org/projects/tor/ticket/9701#comment:32
michael@0 | 1 | load(libdir + "eqArrayHelper.js"); |
michael@0 | 2 | |
michael@0 | 3 | function f1(a, bIs, b=3, ...rest) { |
michael@0 | 4 | assertEq(a, 1); |
michael@0 | 5 | assertEq(bIs, b); |
michael@0 | 6 | assertEqArray(rest, []); |
michael@0 | 7 | } |
michael@0 | 8 | assertEq(f1.length, 2); |
michael@0 | 9 | f1(1, 3); |
michael@0 | 10 | f1(1, 42, 42); |
michael@0 | 11 | function f2(a=rest, ...rest) { |
michael@0 | 12 | assertEq(a, undefined); |
michael@0 | 13 | } |
michael@0 | 14 | f2(); |
michael@0 | 15 | function f3(a=rest, ...rest) { |
michael@0 | 16 | assertEq(a, 1); |
michael@0 | 17 | assertEqArray(rest, [2, 3, 4]); |
michael@0 | 18 | } |
michael@0 | 19 | f3(1, 2, 3, 4); |
michael@0 | 20 | function f4(a=42, ...f) { |
michael@0 | 21 | assertEq(typeof f, "function"); |
michael@0 | 22 | function f() {} |
michael@0 | 23 | } |
michael@0 | 24 | f4() |