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

Side by Side Diff: test/mjsunit/harmony/block-function-sloppy.js

Issue 1234433002: [es6] Sloppy functions in block (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: We need to use 2 different unresoved proxies Created 5 years, 5 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 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-sloppy --no-legacy-const
6
7
8 (function TestHoistingToBlock() {
9 assertEquals(f, undefined);
10 {
11 assertEquals(1, f());
12 function f() { return 1; }
13 assertEquals(1, f());
14 }
15 assertEquals(1, f());
16 })();
17
18
19 (function TestOnlyOneFunction() {
20 var outer, inner;
21 {
22 function f() { return 1; }
23 inner = f;
24 }
25 outer = f;
26 assertEquals(inner, outer);
27 })();
28
29
30 (function TestNoInitIf() {
rossberg 2015/07/10 12:18:27 You have all these tests for the NoInit case, but
arv (Not doing code reviews) 2015/07/10 12:56:12 Doh! I will add.
31 assertEquals(f, undefined);
32 if (false) {
33 function f() { return 1; }
34 }
35 assertEquals(f, undefined);
36 })();
37
38
39 (function TestNoInitElse() {
40 assertEquals(f, undefined);
41 if (true) {
42 } else {
43 function f() { return 1; }
44 }
45 assertEquals(f, undefined);
46 })();
47
48
49 (function TestNoInitWhile() {
50 assertEquals(f, undefined);
51 while (false) {
52 function f() { return 1; }
53 }
54 assertEquals(f, undefined);
55 })();
56
57
58 (function TestNoInitFor() {
59 assertEquals(f, undefined);
60 for (; false; ) {
61 function f() { return 1; }
62 }
63 assertEquals(f, undefined);
64 })();
65
66
67 (function TestNoInitForLet() {
68 assertEquals(f, undefined);
69 for (let x; false; ) {
70 function f() { return 1; }
71 }
72 assertEquals(f, undefined);
73 })();
74
75
76 (function TestNoInitForIn() {
77 assertEquals(f, undefined);
78 for (var k in {}) {
79 function f() { return 1; }
80 }
81 assertEquals(f, undefined);
82 })();
83
84
85
86 (function TestNoInitForInLet() {
87 assertEquals(f, undefined);
88 for (let k in {}) {
89 function f() { return 1; }
90 }
91 assertEquals(f, undefined);
92 })();
93
94
95 (function TestNoInitForOf() {
96 assertEquals(f, undefined);
97 for (var v of []) {
98 function f() { return 1; }
99 }
100 assertEquals(f, undefined);
101 })();
102
103
104 (function TestNoInitForOfLet() {
105 assertEquals(f, undefined);
106 for (let v of []) {
107 function f() { return 1; }
108 }
109 assertEquals(f, undefined);
110 })();
111
112
113 (function TestNoVarBindingInCaseOfEarlyError() {
114 let f = 1;
115 assertEquals(1, f);
116 {
117 assertEquals(2, f());
118 function f() { return 2; }
119 assertEquals(2, f());
120 }
121 assertEquals(1, f);
122
123 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698