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

Side by Side Diff: test/mjsunit/harmony/regress/regress-3683.js

Issue 720863002: Fix desugaring of let bindings in for loops to handle continue properly (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added tests and comments 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 | Annotate | Revision Log
« no previous file with comments | « src/parser.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 "use strict";
8
9 // Simplest case
10 var count = 0;
11 for (let x = 0; x < 10;) {
12 x++;
13 count++;
14 continue;
15 }
16 assertEquals(10, count);
17
18 // Labeled
19 count = 0;
20 label: for (let x = 0; x < 10;) {
21 while (true) {
22 x++;
23 count++;
24 continue label;
25 }
26 }
27 assertEquals(10, count);
28
29 // Simple and labeled
30 count = 0;
31 label: for (let x = 0; x < 10;) {
32 x++;
33 count++;
34 continue label;
35 }
36 assertEquals(10, count);
37
38 // Shadowing loop variable in same scope as continue
39 count = 0;
40 for (let x = 0; x < 10;) {
41 x++;
42 count++;
43 {
44 let x = "hello";
45 continue;
46 }
47 }
48 assertEquals(10, count);
49
50 // Nested let-bound for loops, inner continue
51 count = 0;
52 for (let x = 0; x < 10;) {
53 x++;
54 for (let y = 0; y < 2;) {
55 y++;
56 count++;
57 continue;
58 }
59 }
60 assertEquals(20, count);
61
62 // Nested let-bound for loops, outer continue
63 count = 0;
64 for (let x = 0; x < 10;) {
65 x++;
66 for (let y = 0; y < 2;) {
67 y++;
68 count++;
69 }
70 continue;
71 }
72 assertEquals(20, count);
73
74 // Nested let-bound for loops, labeled continue
75 count = 0;
76 outer: for (let x = 0; x < 10;) {
77 x++;
78 for (let y = 0; y < 2;) {
79 y++;
80 count++;
81 if (y == 2) continue outer;
82 }
83 }
84 assertEquals(20, count);
OLDNEW
« no previous file with comments | « src/parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698