TL;DR cljs mainline generates different code depending on whether we're in a statement context or an expression context, and doesn't consider return a simple expression context.
More fun:
Degenerate if branches
(fn []
(if cond foo bar)
nil)
Translates to:
function () {
if (cljs.core.truth_(cond)) {} else {}
return null;
}
More poking with mainline cljs revealed something interesting:
If in statement context
Translates to:
If in return placement
Translates to
If in expression context
Translates to
TL;DR cljs mainline generates different code depending on whether we're in a statement context or an expression context, and doesn't consider
return
a simple expression context.More fun:
Degenerate if branches
Translates to: