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

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

Issue 749633002: harmony-scoping: make assignment to 'const' a late error. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Comment update Created 6 years 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
1 // Copyright 2014 the V8 project authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // Flags: --harmony-scoping 5 // Flags: --harmony-scoping
6 6
7 'use strict'; 7 'use strict';
8 8
9 // Top-level code 9 // Top-level code
10 let s = 0; 10 let s = 0;
(...skipping 28 matching lines...) Expand all
39 } 39 }
40 assertEquals(2, s); 40 assertEquals(2, s);
41 41
42 42
43 s = ""; 43 s = "";
44 for (const x in [1,2,3]) { 44 for (const x in [1,2,3]) {
45 s += x; 45 s += x;
46 } 46 }
47 assertEquals("012", s); 47 assertEquals("012", s);
48 48
49 assertThrows("'use strict'; for (const x in [1,2,3]) { x++ }", SyntaxError); 49 assertThrows("'use strict'; for (const x in [1,2,3]) { x++ }", TypeError);
50 50
51 // Function scope 51 // Function scope
52 (function() { 52 (function() {
53 let s = 0; 53 let s = 0;
54 for (const x of [1,2,3]) { 54 for (const x of [1,2,3]) {
55 s += x; 55 s += x;
56 } 56 }
57 assertEquals(6, s); 57 assertEquals(6, s);
58 58
59 let x = 1; 59 let x = 1;
60 s = 0; 60 s = 0;
61 for (const x of [x, x+1, x+2]) { 61 for (const x of [x, x+1, x+2]) {
62 s += x; 62 s += x;
63 } 63 }
64 assertEquals(6, s); 64 assertEquals(6, s);
65 65
66 s = 0; 66 s = 0;
67 var q = 1; 67 var q = 1;
68 for (const q of [q, q+1, q+2]) { 68 for (const q of [q, q+1, q+2]) {
69 s += q; 69 s += q;
70 } 70 }
71 assertEquals(6, s); 71 assertEquals(6, s);
72 72
73 s = ""; 73 s = "";
74 for (const x in [1,2,3]) { 74 for (const x in [1,2,3]) {
75 s += x; 75 s += x;
76 } 76 }
77 assertEquals("012", s); 77 assertEquals("012", s);
78 }()); 78 }());
OLDNEW
« no previous file with comments | « test/mjsunit/harmony/regress/regress-2243.js ('k') | test/webkit/fast/js/basic-strict-mode-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698