better fix for #512 & #2010 (#2019)

- remove duplicated functionalities
- fix similar issue with `else`
This commit is contained in:
Alex Lam S.L
2017-05-29 10:51:41 +08:00
committed by GitHub
parent e62b879b48
commit 1aa38051fb
3 changed files with 86 additions and 60 deletions

View File

@@ -307,6 +307,8 @@ issue_512: {
options = {
conditionals: true,
if_return: true,
sequences: true,
side_effects: true,
}
input: {
function a() {

View File

@@ -136,7 +136,29 @@ defun_hoist_funs: {
function f() {}
function g() {}
function h() {}
!window;
if (window);
}
}
}
defun_else_if_return: {
options = {
hoist_funs: false,
if_return: true,
}
input: {
function e() {
function f() {}
if (window) function g() {}
else return;
function h() {}
}
}
expect: {
function e() {
function f() {}
if (window) function g() {}
function h() {}
}
}
}