OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 function CheckError(source) { | |
6 var exception = null; | |
7 try { | |
8 eval(source); | |
9 } catch (e) { | |
10 exception = e; | |
11 } | |
12 assertNotNull(exception); | |
13 assertEquals( | |
14 "Block-scoped declarations (let, const, function, class) not yet supported outside strict mode", | |
15 exception.message); | |
16 } | |
17 | |
18 | |
19 function CheckOk(source) { | |
20 eval(source); | |
21 } | |
22 | |
23 CheckError("let x = 1;"); | |
adamk
2016/01/05 19:19:05
Same here.
Dan Ehrenberg
2016/01/06 00:27:57
Done
| |
24 CheckError("{ let x = 1; }"); | |
25 CheckError("function f() { let x = 1; }"); | |
26 CheckError("for (let x = 1; x < 1; x++) {}"); | |
27 CheckError("for (let x of []) {}"); | |
28 CheckError("for (let x in []) {}"); | |
29 CheckError("class C {}"); | |
30 CheckError("class C extends Array {}"); | |
31 CheckError("(class {});"); | |
32 CheckError("(class extends Array {});"); | |
33 CheckError("(class C {});"); | |
34 CheckError("(class C exends Array {});"); | |
35 | |
36 CheckOk("let = 1;"); | |
37 CheckOk("{ let = 1; }"); | |
38 CheckOk("function f() { let = 1; }"); | |
39 CheckOk("for (let = 1; let < 1; let++) {}"); | |
OLD | NEW |