Fixups after merge
This commit is contained in:
@@ -294,6 +294,13 @@ var AST_Scope = DEFNODE("Scope", "is_block_scope directives variables functions
|
||||
parent_scope: "[AST_Scope?/S] link to the parent scope",
|
||||
enclosed: "[SymbolDef*/S] a list of all symbol definitions that are accessed from this scope or any subscopes",
|
||||
cname: "[integer/S] current index for mangling variables (used internally by the mangler)",
|
||||
},
|
||||
get_defun_scope: function () {
|
||||
var self = this;
|
||||
while (self.is_block_scope && self.parent_scope) {
|
||||
self = self.parent_scope;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
}, AST_Block);
|
||||
|
||||
|
||||
@@ -323,7 +323,7 @@ merge(Compressor.prototype, {
|
||||
if (side_effects_encountered |= lvalues_encountered) continue;
|
||||
|
||||
// Non-constant single use vars can only be replaced in same scope.
|
||||
if (ref.scope !== self) {
|
||||
if (ref.scope.get_defun_scope() !== self) {
|
||||
side_effects_encountered |= var_decl.value.has_side_effects(compressor);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -117,13 +117,13 @@ regression_block_scope_resolves: {
|
||||
expect: {
|
||||
(function () {
|
||||
if (1) {
|
||||
let a;
|
||||
const b;
|
||||
let o;
|
||||
const n;
|
||||
class c {};
|
||||
}
|
||||
if (1) {
|
||||
let a;
|
||||
const b;
|
||||
let o;
|
||||
const n;
|
||||
class c {};
|
||||
}
|
||||
console.log(x, y, Zee, ex, why, Zi);
|
||||
|
||||
@@ -62,9 +62,9 @@ shorthand_properties: {
|
||||
return value;
|
||||
})();
|
||||
expect: (function() {
|
||||
var a = 1;
|
||||
const b = {prop:a};
|
||||
return b;
|
||||
var n = 1;
|
||||
const r = {prop:n};
|
||||
return r;
|
||||
})();
|
||||
}
|
||||
|
||||
@@ -271,8 +271,8 @@ class_name_can_be_mangled: {
|
||||
expect: {
|
||||
function x() {
|
||||
class a { }
|
||||
var b = a
|
||||
var c = class a {}
|
||||
var n = a
|
||||
var r = class a {}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -354,13 +354,13 @@ import_statement_mangling: {
|
||||
Whatever();
|
||||
}
|
||||
expect: {
|
||||
import a from "foo";
|
||||
import b, {Food as c} from "lel";
|
||||
import {What as d} from "lel";
|
||||
a();
|
||||
b();
|
||||
c();
|
||||
d();
|
||||
import l from "foo";
|
||||
import e, {Food as o} from "lel";
|
||||
import {What as f} from "lel";
|
||||
l();
|
||||
e();
|
||||
o();
|
||||
f();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user