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
That happens because we rewrite return voidExpr to {voidExpr; return;}. However if that's a final expression there's no need to generate the final return.
While this is a minor issue that was pretty rare in real-world code, it occurs more often now with arrow functions that just call some void function (like in the example above), so we might want to get rid of that final return for the sake of nicer code generation.
I'm not sure if it's possible to check at the point when we rewrite return voidExpr, maybe it should be done in the analyzer CFG builder or some cleanup module...
The text was updated successfully, but these errors were encountered:
The question here is if we only want to avoid that return in the return void case or if we always want to remove redundant returns, even if written by users.
This generates:
That happens because we rewrite
return voidExpr
to{voidExpr; return;}
. However if that's a final expression there's no need to generate the final return.While this is a minor issue that was pretty rare in real-world code, it occurs more often now with arrow functions that just call some void function (like in the example above), so we might want to get rid of that final
return
for the sake of nicer code generation.I'm not sure if it's possible to check at the point when we rewrite
return voidExpr
, maybe it should be done in the analyzer CFG builder or some cleanup module...The text was updated successfully, but these errors were encountered: