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

Side by Side Diff: test/mjsunit/harmony/block-let-contextual-sloppy.js

Issue 1315673009: Sloppy-mode let parsing (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: clarify comment Created 5 years, 3 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
« 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 2015 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-sloppy --harmony-sloppy-let --harmony-destructuring
6
7
8 {
9 assertThrows(function() { return let; }, ReferenceError);
10 let let;
11
12 let = 5;
13 assertEquals(5, let);
14
15 { let let = 1; assertEquals(1, let); }
16 assertEquals(5, let);
17 }
18
19 assertThrows(function() { return let; }, ReferenceError);
20
21 (function() {
22 var let, sum = 0;
23 for (let in [1, 2, 3, 4]) sum += Number(let);
24 assertEquals(6, sum);
25
26 for (let let of [4, 5]) sum += let;
27 assertEquals(15, sum);
28
29 for (let let in [6]) sum += Number([6][let]);
30 assertEquals(21, sum);
31
32 for (let = 7; let < 8; let++) sum += let;
33 assertEquals(28, sum);
34 assertEquals(8, let);
35
36 for (let let = 8; let < 9; let++) sum += let;
37 assertEquals(36, sum);
38 assertEquals(8, let);
39 })()
40
41 assertThrows(function() { return let; }, ReferenceError);
42
43 {
44 let obj = {};
45 let {let} = {let() { return obj; }};
46 let().x = 1;
47 assertEquals(1, obj.x);
48 }
49
50 {
51 let obj = {};
52 let [let] = [function() { return obj; }];
53 let().x = 1;
54 assertEquals(1, obj.x);
55 }
56
57 (function() {
58 function let() {
59 return 1;
60 }
61 assertEquals(1, let());
62 })()
63
64 assertThrows('for (let of []) {}', SyntaxError);
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