OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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: --strong-mode --harmony-sloppy --harmony-arrow-functions | 5 // Flags: --strong-mode --harmony-sloppy |
6 | 6 |
7 // Repurposing the strict mode 'eval' and 'arguments' tests to test for correct | 7 // Repurposing the strict mode 'eval' and 'arguments' tests to test for correct |
8 // behaviour of 'undefined' as an identifier in strong mode. | 8 // behaviour of 'undefined' as an identifier in strong mode. |
9 "use strict"; | 9 "use strict"; |
10 | 10 |
11 function CheckStrongMode(code) { | 11 function CheckStrongMode(code) { |
12 let strictContexts = [ | 12 let strictContexts = [ |
13 ["'use strict';", ""], | 13 ["'use strict';", ""], |
14 ["function outer() { 'use strict';", "}"], | 14 ["function outer() { 'use strict';", "}"], |
15 ["function outer() { 'use strict'; function inner() {", "}}"], | 15 ["function outer() { 'use strict'; function inner() {", "}}"], |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 assertThrows("(undefined => {'use strong';});"); | 191 assertThrows("(undefined => {'use strong';});"); |
192 | 192 |
193 CheckStrongMode("((undefined, b, c) => {return});"); | 193 CheckStrongMode("((undefined, b, c) => {return});"); |
194 assertThrows("((undefined, b, c) => {'use strong';});"); | 194 assertThrows("((undefined, b, c) => {'use strong';});"); |
195 | 195 |
196 CheckStrongMode("((a, undefined, c) => {return});"); | 196 CheckStrongMode("((a, undefined, c) => {return});"); |
197 assertThrows("((a, undefined, c) => {'use strong';});"); | 197 assertThrows("((a, undefined, c) => {'use strong';});"); |
198 | 198 |
199 CheckStrongMode("((a, b, undefined) => {return});"); | 199 CheckStrongMode("((a, b, undefined) => {return});"); |
200 assertThrows("((a, b, undefined) => {'use strong';});"); | 200 assertThrows("((a, b, undefined) => {'use strong';});"); |
OLD | NEW |