Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(388)

Side by Side Diff: test/mjsunit/es6/block-non-strict-errors.js

Issue 1551443002: Ship ES2015 sloppy-mode function hoisting, let, class (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix duplicate status line Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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++) {}");
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698