| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Flags: --harmony-rest-parameters --harmony-arrow-functions | 5 // Flags: --harmony-rest-parameters |
| 6 // Flags: --min-preparse-length=0 | 6 // Flags: --min-preparse-length=0 |
| 7 | 7 |
| 8 (function testRestIndex() { | 8 (function testRestIndex() { |
| 9 assertEquals(5, ((...args) => args.length)(1,2,3,4,5)); | 9 assertEquals(5, ((...args) => args.length)(1,2,3,4,5)); |
| 10 assertEquals(4, ((a, ...args) => args.length)(1,2,3,4,5)); | 10 assertEquals(4, ((a, ...args) => args.length)(1,2,3,4,5)); |
| 11 assertEquals(3, ((a, b, ...args) => args.length)(1,2,3,4,5)); | 11 assertEquals(3, ((a, b, ...args) => args.length)(1,2,3,4,5)); |
| 12 assertEquals(2, ((a, b, c, ...args) => args.length)(1,2,3,4,5)); | 12 assertEquals(2, ((a, b, c, ...args) => args.length)(1,2,3,4,5)); |
| 13 assertEquals(1, ((a, b, c, d, ...args) => args.length)(1,2,3,4,5)); | 13 assertEquals(1, ((a, b, c, d, ...args) => args.length)(1,2,3,4,5)); |
| 14 assertEquals(0, ((a, b, c, d, e, ...args) => args.length)(1,2,3,4,5)); | 14 assertEquals(0, ((a, b, c, d, e, ...args) => args.length)(1,2,3,4,5)); |
| 15 })(); | 15 })(); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 })(); | 136 })(); |
| 137 | 137 |
| 138 | 138 |
| 139 (function testUnmappedArguments() { | 139 (function testUnmappedArguments() { |
| 140 // Normal functions make their arguments object unmapped, but arrow | 140 // Normal functions make their arguments object unmapped, but arrow |
| 141 // functions don't have an arguments object anyway. Check that the | 141 // functions don't have an arguments object anyway. Check that the |
| 142 // right thing happens for arguments in arrow functions with rest | 142 // right thing happens for arguments in arrow functions with rest |
| 143 // parameters. | 143 // parameters. |
| 144 assertSame(arguments, ((...rest) => arguments)()); | 144 assertSame(arguments, ((...rest) => arguments)()); |
| 145 })(); | 145 })(); |
| OLD | NEW |