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: --no-harmony-sloppy-let --no-harmony-sloppy-function | |
6 // Flags: --no-harmony-sloppy | |
7 | |
8 function CheckError(source) { | 5 function CheckError(source) { |
9 var exception = null; | 6 var exception = null; |
10 try { | 7 try { |
11 eval(source); | 8 eval(source); |
12 } catch (e) { | 9 } catch (e) { |
13 exception = e; | 10 exception = e; |
14 } | 11 } |
15 assertNotNull(exception); | 12 assertNotNull(exception); |
16 assertEquals( | 13 assertEquals( |
17 "Block-scoped declarations (let, const, function, class) not yet supported
outside strict mode", | 14 "Block-scoped declarations (let, const, function, class) not yet supported
outside strict mode", |
(...skipping 15 matching lines...) Expand all Loading... |
33 CheckError("class C extends Array {}"); | 30 CheckError("class C extends Array {}"); |
34 CheckError("(class {});"); | 31 CheckError("(class {});"); |
35 CheckError("(class extends Array {});"); | 32 CheckError("(class extends Array {});"); |
36 CheckError("(class C {});"); | 33 CheckError("(class C {});"); |
37 CheckError("(class C exends Array {});"); | 34 CheckError("(class C exends Array {});"); |
38 | 35 |
39 CheckOk("let = 1;"); | 36 CheckOk("let = 1;"); |
40 CheckOk("{ let = 1; }"); | 37 CheckOk("{ let = 1; }"); |
41 CheckOk("function f() { let = 1; }"); | 38 CheckOk("function f() { let = 1; }"); |
42 CheckOk("for (let = 1; let < 1; let++) {}"); | 39 CheckOk("for (let = 1; let < 1; let++) {}"); |
OLD | NEW |