-
-
Notifications
You must be signed in to change notification settings - Fork 184
Closed
Labels
Description
let x = 0;
switch (x) {
case 1:
hoisted();
break;
case 2:
function hoisted() {
console.log("hoisted");
}
break;
}It looks like hoisting inside a switch statement causes a crash inside TSTL:
Exception has occurred: AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:
nativeAssert(value, message)
at Object.assert (utils.js:67:5)
at hoistVariableDeclarations (transformation\utils\scope.js:157:21)
at Object.performHoisting (transformation\utils\scope.js:113:14)
at Object.transformSwitchStatement [as transform] (transformation\visitors\switch.js:60:26)
at TransformationContext.transformNode (transformation\context\context.js:44:62)
at transformation\context\context.js:70:58
at Array.flatMap (<anonymous>)
at TransformationContext.transformStatements (transformation\context\context.js:70:40)
at Object.transformSourceFileNode [as transform] (transformation\visitors\sourceFile.js:29:63)
at TransformationContext.transformNode (transformation\context\context.js:44:62)
Reactions are currently unavailable