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

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

Issue 713413003: harmony-scoping: better error messages for let declarations in sloppy mode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Patch for landing Created 6 years, 1 month 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
« no previous file with comments | « test/cctest/test-parsing.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Flags: --harmony-scoping
6
7 function CheckError(source) {
8 var exception = null;
9 try {
10 eval(source);
11 } catch (e) {
12 exception = e;
13 }
14 assertNotNull(exception);
15 assertEquals(
16 "Lexical declarations are currently only allowed in strict mode",
17 exception.message);
18 }
19
20
21 function CheckOk(source) {
22 eval(source);
23 }
24
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
32 CheckOk("let = 1;");
33 CheckOk("{ let = 1; }");
34 CheckOk("function f() { let = 1; }");
35 CheckOk("for (let = 1; let < 1; let++) {}");
OLDNEW
« no previous file with comments | « test/cctest/test-parsing.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698