make sure classes don't have their surrounding blocks removed too

This commit is contained in:
Fábio Santos 2018-03-15 18:40:06 +00:00
parent 55acf310f8
commit f4e1a23de7
2 changed files with 12 additions and 1 deletions

View File

@ -3118,7 +3118,8 @@ merge(Compressor.prototype, {
function can_be_extracted_from_if_block(node) {
return !(
node instanceof AST_Const ||
node instanceof AST_Let
node instanceof AST_Let ||
node instanceof AST_Class
);
}

View File

@ -200,6 +200,11 @@ issue_2946_else_const: {
} else {
let w = 48;
}
if (3) {
class X {}
} else {
class Y {}
}
}
expect: {
if (1) {
@ -212,5 +217,10 @@ issue_2946_else_const: {
} else {
let w = 48;
}
if (3) {
class X {}
} else {
class Y {}
}
}
}