fix corner case in reduce_vars (#4665)

fixes #4664
This commit is contained in:
Alex Lam S.L
2021-02-18 18:04:33 +00:00
committed by GitHub
parent 7b4fd858ba
commit 10de27ca3d
3 changed files with 36 additions and 6 deletions

View File

@@ -10,7 +10,7 @@ var info = require("../package.json");
var path = require("path");
var UglifyJS = require("../tools/node");
var skip_keys = [ "cname", "inlined", "parent_scope", "scope", "uses_eval", "uses_with" ];
var skip_keys = [ "cname", "fixed", "inlined", "parent_scope", "scope", "uses_eval", "uses_with" ];
var files = {};
var options = {};
var short_forms = {
@@ -360,14 +360,14 @@ function run() {
}
print(JSON.stringify(result.ast, function(key, value) {
if (value) switch (key) {
case "thedef":
return symdef(value);
case "enclosed":
return value.length ? value.map(symdef) : undefined;
case "variables":
case "functions":
case "globals":
case "variables":
return value.size() ? value.map(symdef) : undefined;
case "thedef":
return symdef(value);
}
if (skip_key(key)) return;
if (value instanceof UglifyJS.AST_Token) return;