Skip to content

Commit 9e87edf

Browse files
authored
better fix for #2506 (#3099)
1 parent 27211cf commit 9e87edf

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

Diff for: lib/compress.js

+2-7
Original file line numberDiff line numberDiff line change
@@ -1031,19 +1031,14 @@ merge(Compressor.prototype, {
10311031
return node;
10321032
}
10331033
var def = candidate.name.definition();
1034-
var value = candidate.value;
10351034
if (def.references.length - def.replaced == 1 && !compressor.exposed(def)) {
10361035
def.replaced++;
1037-
if (funarg && is_identifier_atom(value)) {
1038-
return value.transform(compressor);
1039-
} else {
1040-
return maintain_this_binding(parent, node, value);
1041-
}
1036+
return maintain_this_binding(parent, node, candidate.value);
10421037
}
10431038
return make_node(AST_Assign, candidate, {
10441039
operator: "=",
10451040
left: make_node(AST_SymbolRef, candidate.name, candidate.name),
1046-
right: value
1041+
right: candidate.value
10471042
});
10481043
}
10491044
candidate.write_only = false;

Diff for: test/compress/collapse_vars.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3751,7 +3751,7 @@ issue_2506: {
37513751
function f0(bar) {
37523752
function f1(Infinity_2) {
37533753
function f13(NaN) {
3754-
if (false <= NaN & this >> 1 >= 0) {
3754+
if (false <= NaN & f0 >> 1 >= 0) {
37553755
c++;
37563756
}
37573757
}
@@ -3767,7 +3767,7 @@ issue_2506: {
37673767
function f0(bar) {
37683768
(function(Infinity_2) {
37693769
(function(NaN) {
3770-
if (false <= 0/0 & this >> 1 >= 0)
3770+
if (false <= 0/0 & f0 >> 1 >= 0)
37713771
c++;
37723772
})(0, c++);
37733773
})();

0 commit comments

Comments
 (0)