committed by
Alex Lam S.L
parent
a784717fe2
commit
1241600013
@@ -546,7 +546,7 @@ AST_Toplevel.DEFMETHOD("mangle_names", function(options){
|
|||||||
var mangle_with_block_scope =
|
var mangle_with_block_scope =
|
||||||
(!options.ie8 && node instanceof AST_SymbolCatch) ||
|
(!options.ie8 && node instanceof AST_SymbolCatch) ||
|
||||||
node instanceof AST_SymbolBlockDeclaration;
|
node instanceof AST_SymbolBlockDeclaration;
|
||||||
if (mangle_with_block_scope) {
|
if (mangle_with_block_scope && options.reserved.indexOf(node.name) < 0) {
|
||||||
to_mangle.push(node.definition());
|
to_mangle.push(node.definition());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -804,3 +804,39 @@ object_spread_of_sequence: {
|
|||||||
console.log({ ...o || o });
|
console.log({ ...o || o });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// issue 2316
|
||||||
|
class_name_can_be_preserved_with_reserved: {
|
||||||
|
mangle = {
|
||||||
|
reserved: ['Foo']
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
function x() {
|
||||||
|
class Foo {};
|
||||||
|
Foo.bar;
|
||||||
|
class Bar {};
|
||||||
|
Bar.foo;
|
||||||
|
}
|
||||||
|
|
||||||
|
function y() {
|
||||||
|
var Foo = class Foo {};
|
||||||
|
Foo.bar();
|
||||||
|
var Bar = class Bar {};
|
||||||
|
Bar.bar();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
function x() {
|
||||||
|
class Foo {}
|
||||||
|
Foo.bar;
|
||||||
|
class a{}
|
||||||
|
a.foo
|
||||||
|
}
|
||||||
|
function y() {
|
||||||
|
var Foo = class Foo {};
|
||||||
|
Foo.bar();
|
||||||
|
var a = class a{};
|
||||||
|
a.bar()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user