Fixups after merge

This commit is contained in:
Richard van Velzen
2016-04-18 15:51:32 +02:00
parent f94497d1d6
commit 68cc14f846
4 changed files with 24 additions and 17 deletions

View File

@@ -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);

View File

@@ -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;
}