retain names in export default class and function (#2122)

fixes #2121
This commit is contained in:
kzc
2017-06-19 02:30:59 -04:00
committed by Alex Lam S.L
parent a298bcce02
commit 849ba79dee
3 changed files with 37 additions and 11 deletions

View File

@@ -2226,9 +2226,7 @@ merge(Compressor.prototype, {
function before(node, descend, in_list) {
var parent = tt.parent();
if (!compressor.option("keep_fnames")
&& ((node instanceof AST_Function || node instanceof AST_ClassExpression) && node.name
|| (node instanceof AST_Defun || node instanceof AST_DefClass)
&& parent instanceof AST_Export && parent.is_default)) {
&& node.name && (node instanceof AST_Function || node instanceof AST_ClassExpression)) {
var def = node.name.definition();
// any declarations with same name will overshadow
// name of this anonymous function and can therefore