issue 2316 mangle and reserved
This commit is contained in:
parent
daf099178d
commit
3aabf88c0b
|
|
@ -549,6 +549,9 @@ 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 (options.reserved.indexOf(node.name) >= 0) {
|
||||||
|
mangle_with_block_scope = false;
|
||||||
|
}
|
||||||
if (mangle_with_block_scope) {
|
if (mangle_with_block_scope) {
|
||||||
to_mangle.push(node.definition());
|
to_mangle.push(node.definition());
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -804,3 +804,21 @@ 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
function x(){class Foo{}Foo.bar;class o{}o.foo}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user