From b9798a01a83269a6299d1f1e28d1e8f6d51b5726 Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Tue, 17 Nov 2020 04:59:44 +0000 Subject: fix corner case in `reduce_vars` (#4281) fixes #4280 --- lib/compress.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'lib/compress.js') diff --git a/lib/compress.js b/lib/compress.js index 7297938a..a16c9a69 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -619,7 +619,15 @@ merge(Compressor.prototype, { if (node.key instanceof AST_Node) node.key.walk(tw); fixed = function() { var key = node.key; - return make_node(typeof key == "string" ? AST_Dot : AST_Sub, node, { + var type = AST_Sub; + if (typeof key == "string") { + if (is_identifier_string(key)) { + type = AST_Dot; + } else { + key = make_node_from_constant(key, node); + } + } + return make_node(type, node, { expression: save(), property: key }); -- cgit v1.2.3