Print the operands of in and loop headers with the levels JS needs
Why
Js_dump printed both operands of the in operator, which Dict.has compiles to, at level 0, so that a conditional, a sequence or a comparison got no parentheses and JavaScript took only part of it as the operand. It also printed an in without parentheses at levels up to 12, so that an in on the right of a comparison, or an operand of +, was split the same way. In now takes its levels from instanceof, which is in the same class of operators.
The start of a for loop whose end is a number or a variable, and what for...of and for await...of iterate, were printed at level 0 as well. JavaScript reads a comma in the start as the next declaration and doesn't allow one in an iterable, so a sequence was a syntax error, or, in a start ending in a variable, a second loop variable. They are now printed at level 1.
modifiedJS operands of in
let property = (d, b) => d->Dict.has(b ? "x" : "y")let obj = (b, d, e) => (b ? d : e)->Dict.has("a")
js
modifiedJS in as an operand
let lessThan = (d, e) => d->Dict.has("a") < e->Dict.has("a")js
modifiedJS sequence in a loop header
let start = (f, g) => for i in { f() g() } to 5 { f() }let iterable = (f, items: array<int>) => for _ of { f() items } { f() }
js
Review
- Do other outputs change? A dict literal tested with
inis now printed askey in ({a: 1}), as an object literal is as the operand of any other operator. No other checked-in output changes.