overlookmotel / livepack

Serialize live running code to Javascript
MIT License
30 stars 0 forks source link

Failure to inline where function refers to itself #529

Open overlookmotel opened 9 months ago

overlookmotel commented 9 months ago

Input:

const f = (0, () => f);
f.x = 123;
export default f;

Output:

const a = (f => f = (0, () => f))();
Object.assign(a, {x: 123});
export default a;

The output could be a single line:

export default Object.assign((f => f = (0, () => f))(), {x: 123});

Looks like the function's dependency on itself results in f erroneously being identified as requiring its own variable.