fix corner cases in aliasing of global variables (#4039)

fixes #4038
This commit is contained in:
Alex Lam S.L
2020-08-06 09:39:50 +01:00
committed by GitHub
parent 30ef20a208
commit 9b05494ebc
4 changed files with 115 additions and 16 deletions

View File

@@ -1175,7 +1175,8 @@ function log(options) {
}
function sort_globals(code) {
return "var " + sandbox.run_code("throw Object.keys(this).sort();" + code).join(",") + ";" + code;
var globals = sandbox.run_code("throw Object.keys(this).sort();" + code);
return globals.length ? "var " + globals.join(",") + ";" + code : code;
}
function fuzzy_match(original, uglified) {