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",
|
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",
|
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)",
|
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);
|
}, AST_Block);
|
||||||
|
|
||||||
|
|||||||
@@ -323,7 +323,7 @@ merge(Compressor.prototype, {
|
|||||||
if (side_effects_encountered |= lvalues_encountered) continue;
|
if (side_effects_encountered |= lvalues_encountered) continue;
|
||||||
|
|
||||||
// Non-constant single use vars can only be replaced in same scope.
|
// 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);
|
side_effects_encountered |= var_decl.value.has_side_effects(compressor);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,13 +117,13 @@ regression_block_scope_resolves: {
|
|||||||
expect: {
|
expect: {
|
||||||
(function () {
|
(function () {
|
||||||
if (1) {
|
if (1) {
|
||||||
let a;
|
let o;
|
||||||
const b;
|
const n;
|
||||||
class c {};
|
class c {};
|
||||||
}
|
}
|
||||||
if (1) {
|
if (1) {
|
||||||
let a;
|
let o;
|
||||||
const b;
|
const n;
|
||||||
class c {};
|
class c {};
|
||||||
}
|
}
|
||||||
console.log(x, y, Zee, ex, why, Zi);
|
console.log(x, y, Zee, ex, why, Zi);
|
||||||
|
|||||||
@@ -62,9 +62,9 @@ shorthand_properties: {
|
|||||||
return value;
|
return value;
|
||||||
})();
|
})();
|
||||||
expect: (function() {
|
expect: (function() {
|
||||||
var a = 1;
|
var n = 1;
|
||||||
const b = {prop:a};
|
const r = {prop:n};
|
||||||
return b;
|
return r;
|
||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -271,8 +271,8 @@ class_name_can_be_mangled: {
|
|||||||
expect: {
|
expect: {
|
||||||
function x() {
|
function x() {
|
||||||
class a { }
|
class a { }
|
||||||
var b = a
|
var n = a
|
||||||
var c = class a {}
|
var r = class a {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -354,13 +354,13 @@ import_statement_mangling: {
|
|||||||
Whatever();
|
Whatever();
|
||||||
}
|
}
|
||||||
expect: {
|
expect: {
|
||||||
import a from "foo";
|
import l from "foo";
|
||||||
import b, {Food as c} from "lel";
|
import e, {Food as o} from "lel";
|
||||||
import {What as d} from "lel";
|
import {What as f} from "lel";
|
||||||
a();
|
l();
|
||||||
b();
|
e();
|
||||||
c();
|
o();
|
||||||
d();
|
f();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user