Problem
[email protected]:
Lscdiag
f() ->
for let i = 0; i < 10; i++:
val = if check:
val2 = 3
val2
else:
val3 = 4
val3
compiles to
function f() {
for (let i = 0; i < 10; i++) {
const val = check ? function () {
var _ret;
const val2 = 3;
_ret = val2;
return _ret;
}() : function () {
const val3 = 4;
return _ret = val3;
}();
}
}
The generated _ret var is not in scope in the second function block, so this code will crash with a no-undef error if check is false. However, it's a mystery to me why that _ret var is being generated at all.
If the enclosing for loop is removed, the problem goes away: lscdiag
Problem
[email protected]:Lscdiag
compiles to
The generated
_retvar is not in scope in the secondfunctionblock, so this code will crash with a no-undef error ifcheckis false. However, it's a mystery to me why that_retvar is being generated at all.If the enclosing
forloop is removed, the problem goes away: lscdiag