Ticket #84 (closed defect)

Opened 16 years ago

Last modified 16 years ago

Incorrect rendering of for-in blocks

Reported by: untyped Owned by: dherman
Priority: major Milestone:
Component: dherman/javascript.plt Keywords: javascript mirrors for for-in
Cc: Version: (6 4)
Racket Version: 4.1.0.4

Description

Hi Dave,

More details and test code coming to you in an email:

for-in statements don't render correctly when they have multiple init vars. Here's an example:

Mirrors code:

(javascript->pretty-string
 (js (for-in ((var key val) (!object [a 1] [b 2] [c 3]))
       (alert (+ key ": " val)))))

Expected output:

for (var key, val in { a: 1, b: 2, c: 3 })
    alert(key + ": " + val);

Actual output:

Expected output:

for (var key in { a: 1, b: 2, c: 3 })
    alert(key + ": " + val);

Cheers,

-- Dave Gurnell

Change History

Changed 16 years ago by dherman

  • status changed from new to closed

A for-in loop can only bind a single variable, so this test case should fail. I've opened a separate bug that the sexp parser should fault on multiple variables in a for-in (see #89).

Note: See TracTickets for help on using tickets.