| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 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 | 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-restrictive-declarations | |
| 6 | |
| 7 // ES#sec-functiondeclarations-in-ifstatement-statement-clauses | 5 // ES#sec-functiondeclarations-in-ifstatement-statement-clauses |
| 8 // Annex B 3.4 FunctionDeclarations in IfStatement Statement Clauses | 6 // Annex B 3.4 FunctionDeclarations in IfStatement Statement Clauses |
| 9 // In sloppy mode, function declarations in if statements act like | 7 // In sloppy mode, function declarations in if statements act like |
| 10 // they have a block around them. Prohibited in strict mode. | 8 // they have a block around them. Prohibited in strict mode. |
| 11 (function() { | 9 (function() { |
| 12 if (false) function f() { }; | 10 if (false) function f() { }; |
| 13 assertEquals(undefined, f); | 11 assertEquals(undefined, f); |
| 14 })(); | 12 })(); |
| 15 | 13 |
| 16 (function() { | 14 (function() { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 43 | 41 |
| 44 (function() { | 42 (function() { |
| 45 function bar() { | 43 function bar() { |
| 46 return f; | 44 return f; |
| 47 { | 45 { |
| 48 x: function f() {} | 46 x: function f() {} |
| 49 } | 47 } |
| 50 } | 48 } |
| 51 assertEquals(undefined, bar()); | 49 assertEquals(undefined, bar()); |
| 52 })(); | 50 })(); |
| OLD | NEW |