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.
5 // Flags: --harmony-scoping --harmony-classes
7 function CheckError(source) {
14 assertNotNull(exception);
16 "Block-scoped declarations (let, const, function, class) not yet supported outside strict mode",
21 function CheckOk(source) {
25 CheckError("let x = 1;");
26 CheckError("{ let x = 1; }");
27 CheckError("function f() { let x = 1; }");
28 CheckError("for (let x = 1; x < 1; x++) {}");
29 CheckError("for (let x of []) {}");
30 CheckError("for (let x in []) {}");
31 CheckError("class C {}");
32 CheckError("class C extends Array {}");
33 CheckError("(class {});");
34 CheckError("(class extends Array {});");
35 CheckError("(class C {});");
36 CheckError("(class C exends Array {});");
39 CheckOk("{ let = 1; }");
40 CheckOk("function f() { let = 1; }");
41 CheckOk("for (let = 1; let < 1; let++) {}");