Declarations and ThrowStatement in an IfStatement within DoExpression breaks compilation #5080
Labels
Has PR
i: bug
outdated
A closed issue/PR that is archived due to age. Recommended to make a new issue
Spec: Do Expressions
Input Code
Example in the REPL
Babel Configuration (.babelrc, package.json, cli command)
Using
es2015
andstage-0
Expected Behavior
It should wrap the body in an IIFE.
Current Behavior
It doesn't think that an IIFE is required but when the plugin tries to get the completion record for the relevant if statement it finds undefined and passes that to either the
consequent
oralternate
of aConditionalExpression
, which throws:Possible Solution
Detect this scenario and wrap in an IIFE, or add a helper that turns
throw e
into_throw(e)
and hoist + rename declarations.The text was updated successfully, but these errors were encountered: