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

Side by Side Diff: test/mjsunit/regress/regress-2506.js

Issue 1007783002: Remove --harmony-scoping flag. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: CR feedback Created 5 years, 9 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/mjsunit/mjsunit.status ('k') | test/mjsunit/strict-mode.js » ('j') | 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 // Top-level code
10 let s = 0;
11 let f = [undefined, undefined, undefined]
12 for (const x of [1,2,3]) {
13 s += x;
14 f[x-1] = function() { return x; }
15 }
16 assertEquals(6, s);
17 assertEquals(1, f[0]());
18 assertEquals(2, f[1]());
19 assertEquals(3, f[2]());
20
21 let x = 1;
22 s = 0;
23 for (const x of [x, x+1, x+2]) {
24 s += x;
25 }
26 assertEquals(6, s);
27
28 s = 0;
29 var q = 1;
30 for (const q of [q, q+1, q+2]) {
31 s += q;
32 }
33 assertEquals(6, s);
34
35 let z = 1;
36 s = 0;
37 for (const x = 1; z < 2; z++) {
38 s += x + z;
39 }
40 assertEquals(2, s);
41
42
43 s = "";
44 for (const x in [1,2,3]) {
45 s += x;
46 }
47 assertEquals("012", s);
48
49 assertThrows("'use strict'; for (const x in [1,2,3]) { x++ }", TypeError);
50
51 // Function scope
52 (function() {
53 let s = 0;
54 for (const x of [1,2,3]) {
55 s += x;
56 }
57 assertEquals(6, s);
58
59 let x = 1;
60 s = 0;
61 for (const x of [x, x+1, x+2]) {
62 s += x;
63 }
64 assertEquals(6, s);
65
66 s = 0;
67 var q = 1;
68 for (const q of [q, q+1, q+2]) {
69 s += q;
70 }
71 assertEquals(6, s);
72
73 s = "";
74 for (const x in [1,2,3]) {
75 s += x;
76 }
77 assertEquals("012", s);
78 }());
OLDNEW
« no previous file with comments | « test/mjsunit/mjsunit.status ('k') | test/mjsunit/strict-mode.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698