ES6 B.3.4: FunctionDeclaration in IfStatement parsed incorrectly
Open
parsing
test262
- Dominant language
- Rust
- Stars
- 22.3k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
[§ B.3.4](http://www.ecma-international.org/ecma-262/6.0/#sec-functiondeclarations-in-ifstatement-statement-clauses) allows `FunctionDeclaration` to appear in either branch of an `IfStatement` in non-strict mode. In strict mode, they are forbidden on both sides.
Flow incorrectly parses a function in an else branch as `FunctionExpression`.
```
if (false) function f() {} else function g() {}
^^^^^^^^^^^^^^^ FunctionDeclaration, good
^^^^^^^^^^^^^^^ FunctionExpression, wrong
```
Contributor guide
Assessment
This issue has not been assessed yet.