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/block-let-contextual-sloppy.js

Issue 1371263003: Prohibit let in lexical bindings (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: remove messages.js test Created 5 years, 2 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/message/let-lexical-name-prohibited.out ('k') | test/test262/test262.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 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 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-sloppy --harmony-sloppy-let --harmony-destructuring 5 // Flags: --harmony-sloppy --harmony-sloppy-let --harmony-destructuring
6 6
7 // let is usable as a variable with var or legacy const, not let or ES6 const
7 8
8 { 9 (function (){
9 assertThrows(function() { return let; }, ReferenceError); 10 assertEquals(undefined, let);
10 let let; 11
12 var let;
11 13
12 let = 5; 14 let = 5;
13 assertEquals(5, let); 15 assertEquals(5, let);
14 16
15 { let let = 1; assertEquals(1, let); } 17 (function() { var let = 1; assertEquals(1, let); })();
16 assertEquals(5, let); 18 assertEquals(5, let);
17 } 19 })();
18 20
19 assertThrows(function() { return let; }, ReferenceError); 21 assertThrows(function() { return let; }, ReferenceError);
20 22
21 (function() { 23 (function() {
22 var let, sum = 0; 24 var let, sum = 0;
23 for (let in [1, 2, 3, 4]) sum += Number(let); 25 for (let in [1, 2, 3, 4]) sum += Number(let);
24 assertEquals(6, sum); 26 assertEquals(6, sum);
25 27
26 for (let let of [4, 5]) sum += let; 28 (function() { for (var let of [4, 5]) sum += let; })();
27 assertEquals(15, sum); 29 assertEquals(15, sum);
28 30
29 for (let let in [6]) sum += Number([6][let]); 31 (function() { for (var let in [6]) sum += Number([6][let]); })();
30 assertEquals(21, sum); 32 assertEquals(21, sum);
31 33
32 for (let = 7; let < 8; let++) sum += let; 34 for (let = 7; let < 8; let++) sum += let;
33 assertEquals(28, sum); 35 assertEquals(28, sum);
34 assertEquals(8, let); 36 assertEquals(8, let);
35 37
36 for (let let = 8; let < 9; let++) sum += let; 38 (function() { for (var let = 8; let < 9; let++) sum += let; })();
37 assertEquals(36, sum); 39 assertEquals(36, sum);
38 assertEquals(8, let); 40 assertEquals(8, let);
39 })() 41 })();
40 42
41 assertThrows(function() { return let; }, ReferenceError); 43 assertThrows(function() { return let; }, ReferenceError);
42 44
43 { 45 (function () {
44 let obj = {}; 46 let obj = {};
45 let {let} = {let() { return obj; }}; 47 var {let} = {let() { return obj; }};
46 let().x = 1; 48 let().x = 1;
47 assertEquals(1, obj.x); 49 assertEquals(1, obj.x);
48 } 50 })();
49 51
50 { 52 (function () {
51 let obj = {}; 53 let obj = {};
52 let [let] = [function() { return obj; }]; 54 const [let] = [function() { return obj; }];
53 let().x = 1; 55 let().x = 1;
54 assertEquals(1, obj.x); 56 assertEquals(1, obj.x);
55 } 57 })();
56 58
57 (function() { 59 (function() {
58 function let() { 60 function let() {
59 return 1; 61 return 1;
60 } 62 }
61 assertEquals(1, let()); 63 assertEquals(1, let());
62 })() 64 })()
63 65
64 assertThrows('for (let of []) {}', SyntaxError); 66 assertThrows('for (let of []) {}', SyntaxError);
OLDNEW
« no previous file with comments | « test/message/let-lexical-name-prohibited.out ('k') | test/test262/test262.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698