| 1 |
// Copyright (C) 2016 the V8 project authors. All rights reserved. |
| 2 |
// This code is governed by the BSD license found in the LICENSE file. |
| 3 |
/*--- |
| 4 |
path: annexB/language/function-code/if-decl-else-decl-a- |
| 5 |
name: IfStatement with a declaration in both statement positions in function scope |
| 6 |
esid: sec-functiondeclarations-in-ifstatement-statement-clauses |
| 7 |
es6id: B.3.4 |
| 8 |
info: | |
| 9 |
The following rules for IfStatement augment those in 13.6: |
| 10 |
|
| 11 |
IfStatement[Yield, Return]: |
| 12 |
if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] else Statement[?Yield, ?Return] |
| 13 |
if ( Expression[In, ?Yield] ) Statement[?Yield, ?Return] else FunctionDeclaration[?Yield] |
| 14 |
if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] else FunctionDeclaration[?Yield] |
| 15 |
if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] |
| 16 |
flags: [noStrict] |
| 17 |
---*/ |
| 18 |
|
| 19 |
(function(/*{ params }*/) { |
| 20 |
/*{ before }*/ |
| 21 |
|
| 22 |
if (true) function f() { /*{ body }*/ } else function _f() {} |
| 23 |
|
| 24 |
/*{ after }*/ |
| 25 |
}(/*{ args }*/)); |