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

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

Issue 2478883002: Remove always-true --harmony-restrictive-declarations flag (Closed)
Patch Set: Formatting Created 4 years, 1 month 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 2016 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-restrictive-declarations
6
7 // ES#sec-functiondeclarations-in-ifstatement-statement-clauses
8 // Annex B 3.4 FunctionDeclarations in IfStatement Statement Clauses
9 // In sloppy mode, function declarations in if statements act like
10 // they have a block around them. Prohibited in strict mode.
11 (function() {
12 if (false) function f() { };
13 assertEquals(undefined, f);
14 })();
15
16 (function() {
17 assertEquals(undefined, f);
18 if (true) function f() { };
19 assertEquals('function', typeof f);
20 })();
21
22 (function() {
23 assertEquals(undefined, f);
24 if (true) {} else function f() { };
25 assertEquals(undefined, f);
26 })();
27
28 (function() {
29 assertEquals(undefined, f);
30 if (false) {} else function f() { };
31 assertEquals('function', typeof f);
32 })();
33
34 // Labeled function declarations undergo the same hoisting/FiB semantics as if
35 // they were unalbeled.
36 (function() {
37 function bar() {
38 return f;
39 x: function f() {}
40 }
41 assertEquals('function', typeof bar());
42 })();
43
44 (function() {
45 function bar() {
46 return f;
47 {
48 x: function f() {}
49 }
50 }
51 assertEquals(undefined, bar());
52 })();
OLDNEW
« no previous file with comments | « test/mjsunit/harmony/sloppy-implicit-block-function.js ('k') | test/mjsunit/regress/regress-220.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698