aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/scope.js6
-rw-r--r--test/compress/classes.js21
-rw-r--r--test/compress/issue-1202.js4
3 files changed, 27 insertions, 4 deletions
diff --git a/lib/scope.js b/lib/scope.js
index 6345bfd3..9d4b8900 100644
--- a/lib/scope.js
+++ b/lib/scope.js
@@ -96,8 +96,10 @@ SymbolDef.prototype = {
|| this.undeclared
|| !options.eval && this.scope.pinned()
|| options.keep_fnames
- && (this.orig[0] instanceof AST_SymbolLambda
- || this.orig[0] instanceof AST_SymbolDefun);
+ && (this.orig[0] instanceof AST_SymbolClass
+ || this.orig[0] instanceof AST_SymbolDefClass
+ || this.orig[0] instanceof AST_SymbolDefun
+ || this.orig[0] instanceof AST_SymbolLambda);
},
};
diff --git a/test/compress/classes.js b/test/compress/classes.js
index cebccf95..46749a27 100644
--- a/test/compress/classes.js
+++ b/test/compress/classes.js
@@ -779,6 +779,27 @@ computed_key_generator: {
node_version: ">=4"
}
+keep_fnames: {
+ options = {
+ keep_fnames: true,
+ toplevel: true,
+ }
+ mangle = {
+ keep_fnames: true,
+ toplevel: true,
+ }
+ input: {
+ "use strict";
+ class Foo {}
+ console.log(Foo.name, class Bar {}.name);
+ }
+ expect: {
+ "use strict";
+ class Foo {}
+ console.log(Foo.name, class Bar {}.name);
+ }
+}
+
issue_805_1: {
options = {
inline: true,
diff --git a/test/compress/issue-1202.js b/test/compress/issue-1202.js
index 1a34a3f1..1ad6be7b 100644
--- a/test/compress/issue-1202.js
+++ b/test/compress/issue-1202.js
@@ -4,7 +4,7 @@ mangle_keep_fnames_false: {
keep_fnames: true,
}
mangle = {
- keep_fnames : false,
+ keep_fnames: false,
}
input: {
"use strict";
@@ -30,7 +30,7 @@ mangle_keep_fnames_true: {
keep_fnames: true,
}
mangle = {
- keep_fnames : true,
+ keep_fnames: true,
}
input: {
"use strict";