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: --harmony-scoping --harmony-classes | 5 // Flags: --harmony-classes |
6 | 6 |
7 function CheckError(source) { | 7 function CheckError(source) { |
8 var exception = null; | 8 var exception = null; |
9 try { | 9 try { |
10 eval(source); | 10 eval(source); |
11 } catch (e) { | 11 } catch (e) { |
12 exception = e; | 12 exception = e; |
13 } | 13 } |
14 assertNotNull(exception); | 14 assertNotNull(exception); |
15 assertEquals( | 15 assertEquals( |
(...skipping 16 matching lines...) Expand all Loading... |
32 CheckError("class C extends Array {}"); | 32 CheckError("class C extends Array {}"); |
33 CheckError("(class {});"); | 33 CheckError("(class {});"); |
34 CheckError("(class extends Array {});"); | 34 CheckError("(class extends Array {});"); |
35 CheckError("(class C {});"); | 35 CheckError("(class C {});"); |
36 CheckError("(class C exends Array {});"); | 36 CheckError("(class C exends Array {});"); |
37 | 37 |
38 CheckOk("let = 1;"); | 38 CheckOk("let = 1;"); |
39 CheckOk("{ let = 1; }"); | 39 CheckOk("{ let = 1; }"); |
40 CheckOk("function f() { let = 1; }"); | 40 CheckOk("function f() { let = 1; }"); |
41 CheckOk("for (let = 1; let < 1; let++) {}"); | 41 CheckOk("for (let = 1; let < 1; let++) {}"); |
OLD | NEW |