hoist_props: implement limited hoisting of class expressions (#2415)
This commit is contained in:
@@ -619,7 +619,11 @@ merge(Compressor.prototype, {
|
||||
|
||||
function mark_escaped(d, node, value, level) {
|
||||
var parent = tw.parent(level);
|
||||
if (value instanceof AST_Constant || value instanceof AST_Function) return;
|
||||
if (value instanceof AST_Constant
|
||||
|| value instanceof AST_Function
|
||||
|| value instanceof AST_ClassExpression) {
|
||||
return;
|
||||
}
|
||||
if (parent instanceof AST_Assign && parent.operator == "=" && node === parent.right
|
||||
|| parent instanceof AST_Call && node !== parent.expression
|
||||
|| parent instanceof AST_Return && node === parent.value && node.scope !== d.scope
|
||||
@@ -4043,7 +4047,8 @@ merge(Compressor.prototype, {
|
||||
function is_object(node) {
|
||||
return node instanceof AST_Array
|
||||
|| node instanceof AST_Lambda
|
||||
|| node instanceof AST_Object;
|
||||
|| node instanceof AST_Object
|
||||
|| node instanceof AST_Class;
|
||||
}
|
||||
|
||||
OPT(AST_Binary, function(self, compressor){
|
||||
|
||||
Reference in New Issue
Block a user