Skip to content

Commit

Permalink
[Bug] Fix hoisting of if statement alternate
Browse files Browse the repository at this point in the history
  • Loading branch information
Siubaak committed May 7, 2020
1 parent 4022862 commit a801707
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/evaluate/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ function* hoistVarRecursion(statement: estree.Statement, scope: Scope): Iterable
break
case 'IfStatement':
yield* hoistVarRecursion(statement.consequent, scope)
yield* hoistVarRecursion(statement.alternate, scope)
if (statement.alternate) {
yield* hoistVarRecursion(statement.alternate, scope)
}
break
case 'BlockStatement':
for (let i = 0; i < statement.body.length; i++) {
Expand Down

0 comments on commit a801707

Please sign in to comment.