swc/crates/swc_ecma_minifier/tests/fixture/issues/5846/output.mangleOnly.js
Donny/강동윤 a5f7b6946f
fix(es/minifier): Don't replace parameters of IIFE if it's recursive (#5852)
**Description:**

While investigating, I found that problem is not the analysis of recursive functions. Instead, it was a problem with the IIFE evaluator, which replaces parameters even if it's recursive.

**Related issue:**

 - Closes https://github.com/swc-project/swc/issues/5846
2022-09-14 05:02:14 +00:00

32 lines
682 B
JavaScript

function e(o, l, n, t) {
const s = o ? o[mergeChildrenPropName] : dataNodes;
const c = o ? getPosition(n.pos, l) : '0';
const a = o ? [
...t,
o
] : [];
if (o) {
const i = syntheticGetKey(o, c);
const d = {
node: o,
index: l,
pos: c,
key: i,
parentPos: n.node ? n.pos : null,
level: n.level + 1,
nodes: a
};
callback(d);
}
if (s) {
s.forEach((l, t)=>{
e(l, t, {
node: o,
pos: c,
level: n ? n.level + 1 : -1
}, a);
});
}
}
e(null);