You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If we can ensure that both branches of a ternary operator are side-effect free with heuristics, we can emit a select() call instead.
Maybe the heuristic essentially boils down to "Is there a call expression in here?"
Note
We can also do proper side-effect analysis to allow side-effect free functions to be used in ternary operators. We can store this as another kind of flag on the snippet type.
If there are more cases where this sort of analysis might be useful, we can prioritize this.
If we can ensure that both branches of a ternary operator are side-effect free with heuristics, we can emit a
select()call instead.Maybe the heuristic essentially boils down to "Is there a call expression in here?"
Note
We can also do proper side-effect analysis to allow side-effect free functions to be used in ternary operators. We can store this as another kind of flag on the snippet type.
If there are more cases where this sort of analysis might be useful, we can prioritize this.