Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add constant violations to references in mangler collect phase (#…
…830) * fix: do not update references for constant violations renaming fix #822 * add constant violations to references in mangler collect phase
- Loading branch information
Showing
3 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
packages/babel-plugin-minify-mangle-names/__tests__/fixtures/issue-822/actual.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
function d3_svg_line(projection) { | ||
var x = d3_geom_pointX, | ||
y = d3_geom_pointY, | ||
defined = d3_true, | ||
interpolate = d3_svg_lineLinear, | ||
interpolateKey = interpolate.key, | ||
tension = 0.7; | ||
|
||
function line(data) { | ||
var segments = [], | ||
points = [], | ||
i = -1, | ||
n = data.length, | ||
d, | ||
fx = d3_functor(x); | ||
function segment() { | ||
segments.push("M", interpolate(projection(points), tension)); | ||
} | ||
while (++i < n) { | ||
if (defined.call(this, (d = data[i]), i)) { | ||
points.push([+fx.call(this, d, i)]); | ||
} else if (points.length) { | ||
segment(); | ||
points = []; | ||
} | ||
} | ||
if (points.length) segment(); | ||
return segments.length ? segments.join("") : null; | ||
} | ||
|
||
return line; | ||
} |
35 changes: 35 additions & 0 deletions
35
packages/babel-plugin-minify-mangle-names/__tests__/fixtures/issue-822/expected.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
function d3_svg_line(a) { | ||
var c = d3_geom_pointX, | ||
d = d3_geom_pointY, | ||
e = d3_true, | ||
f = d3_svg_lineLinear, | ||
g = f.key, | ||
h = 0.7; | ||
|
||
function b(b) { | ||
var j = [], | ||
k = [], | ||
l = -1, | ||
m = b.length, | ||
n, | ||
o = d3_functor(c); | ||
|
||
function g() { | ||
j.push("M", f(a(k), h)); | ||
} | ||
|
||
while (++l < m) { | ||
if (e.call(this, n = b[l], l)) { | ||
k.push([+o.call(this, n, l)]); | ||
} else if (k.length) { | ||
g(); | ||
k = []; | ||
} | ||
} | ||
|
||
if (k.length) g(); | ||
return j.length ? j.join("") : null; | ||
} | ||
|
||
return b; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters