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

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

Issue 1571793002: Reland of Ship ES2015 sloppy-mode function hoisting, let, class (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 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
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-bind
6
7 // let is usable as a variable with var or legacy const, not let or ES6 const
8
9 (function (){
10 assertEquals(undefined, let);
11
12 var let;
13
14 let = 5;
15 assertEquals(5, let);
16
17 (function() { var let = 1; assertEquals(1, let); })();
18 assertEquals(5, let);
19 })();
20
21 assertThrows(function() { return let; }, ReferenceError);
22
23 (function() {
24 var let, sum = 0;
25 for (let in [1, 2, 3, 4]) sum += Number(let);
26 assertEquals(6, sum);
27
28 (function() { for (var let of [4, 5]) sum += let; })();
29 assertEquals(15, sum);
30
31 (function() { for (var let in [6]) sum += Number([6][let]); })();
32 assertEquals(21, sum);
33
34 for (let = 7; let < 8; let++) sum += let;
35 assertEquals(28, sum);
36 assertEquals(8, let);
37
38 (function() { for (var let = 8; let < 9; let++) sum += let; })();
39 assertEquals(36, sum);
40 assertEquals(8, let);
41 })();
42
43 assertThrows(function() { return let; }, ReferenceError);
44
45 (function () {
46 let obj = {};
47 var {let} = {let() { return obj; }};
48 let().x = 1;
49 assertEquals(1, obj.x);
50 })();
51
52 (function () {
53 let obj = {};
54 const [let] = [function() { return obj; }];
55 let().x = 1;
56 assertEquals(1, obj.x);
57 })();
58
59 (function() {
60 function let() {
61 return 1;
62 }
63 assertEquals(1, let());
64 })()
65
66 assertThrows('for (let of []) {}', SyntaxError);
OLDNEW
« no previous file with comments | « test/mjsunit/es6/block-eval-var-over-legacy-const.js ('k') | test/mjsunit/es6/block-non-strict-errors.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698