Closed
Description
Hi, the following code
{
let j = ref(0)
if Js.String.get("%", j.contents) == "%" {
j := j.contents + 1
j := j.contents + 1
} else {
j := j.contents + 1
}
Console.log(j.contents)
}
is compiled into
var j = 0;
j = j + 1 | 0;
if ("%"[j] === "%") {
j = j + 1 | 0;
}
console.log(j);
Note how the assignment of j
is moved outside the if
-expression despite the move changing the evaluation of the condition of the if
-expression. The code without the surrounding {
and }
is compiled correctly.