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-destructuring --harmony-arrow-functions | 5 // Flags: --harmony-destructuring --harmony-arrow-functions |
6 // Flags: --harmony-default-parameters --harmony-rest-parameters | 6 // Flags: --harmony-default-parameters --harmony-rest-parameters |
7 | 7 |
8 (function TestObjectLiteralPattern() { | 8 (function TestObjectLiteralPattern() { |
9 var { x : x, y : y } = { x : 1, y : 2 }; | 9 var { x : x, y : y } = { x : 1, y : 2 }; |
10 assertEquals(1, x); | 10 assertEquals(1, x); |
(...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
946 assertEquals(6, f8(5, 6)); | 946 assertEquals(6, f8(5, 6)); |
947 }()); | 947 }()); |
948 | 948 |
949 | 949 |
950 (function TestForInOfTDZ() { | 950 (function TestForInOfTDZ() { |
951 assertThrows("'use strict'; let x = {}; for (let [x, y] of {x});", ReferenceEr
ror); | 951 assertThrows("'use strict'; let x = {}; for (let [x, y] of {x});", ReferenceEr
ror); |
952 assertThrows("'use strict'; let x = {}; for (let [y, x] of {x});", ReferenceEr
ror); | 952 assertThrows("'use strict'; let x = {}; for (let [y, x] of {x});", ReferenceEr
ror); |
953 assertThrows("'use strict'; let x = {}; for (let [x, y] in {x});", ReferenceEr
ror); | 953 assertThrows("'use strict'; let x = {}; for (let [x, y] in {x});", ReferenceEr
ror); |
954 assertThrows("'use strict'; let x = {}; for (let [y, x] in {x});", ReferenceEr
ror); | 954 assertThrows("'use strict'; let x = {}; for (let [y, x] in {x});", ReferenceEr
ror); |
955 }()); | 955 }()); |
| 956 |
| 957 |
| 958 (function TestFunctionLength() { |
| 959 assertEquals(1, (function({}) {}).length); |
| 960 assertEquals(1, (function([]) {}).length); |
| 961 assertEquals(1, (function({x}) {}).length); |
| 962 assertEquals(1, (function({}, ...a) {}).length); |
| 963 assertEquals(1, (function({x}, {y} = {}) {}).length); |
| 964 assertEquals(1, (function({x}, {y} = {}, ...a) {}).length); |
| 965 assertEquals(2, (function(x, {y}, {z} = {}) {}).length); |
| 966 assertEquals(2, (function({x}, {}, {z} = {}, ...a) {}).length); |
| 967 assertEquals(1, (function(x, {y} = {}, {z}) {}).length); |
| 968 assertEquals(1, (function({x}, {y} = {}, {z}, ...a) {}).length); |
| 969 assertEquals(1, (function(x, {y} = {}, {z}, {v} = {}) {}).length); |
| 970 assertEquals(1, (function({x}, {y} = {}, {z}, {v} = {}, ...a) {}).length); |
| 971 })(); |
OLD | NEW |