Repository navigation
Conversation
Now inline impure rvals assigned to temp lvals if the lval is used in a "simple" way immediately after the assignment.
|
There's couple issues here:
The way I see it, in an ideal implementation we should traverse a tree from node A (source) to node B (destination) checking if everything in between is pure. Either that or we ditch this whole idea (due to complexity) and introduce something like "unsafeInlining" flag. |
|
I'm not sure. There are too many cases where you shouldn't change at all. If it's not hard to detect if we maintain the order of impure calls, we can try harder. assumption: all function calls cause side-effects and order matters.
|
|
Why should it bail on: function bar() {
let {x, y} = a();
return x;
}If we ignore |
let {x, y} = a(); x and y getters are called here. If we remove y, |
|
Closing this as it's been inactive. Please feel free to open a new PR or leave a comment asking to reopen this PR. Thanks! |
Now inline impure rvals assigned to temp lvals if the lval is used in a "simple" way immediately after the assignment.