jashkenas/coffeescript

Bug: Excess variable introduced in destructured `for ... from` loop

STRd6 opened this issue · 0 comments

STRd6 commented

Input Code

for {x} from y
  x

Expected Behavior

var x;
for ({x} of y) {
  x;
}

Current Behavior

var x, z;

for (z of y) {
  ({x} = z);
  x;
}

Possible Solution

Extra variable z shouldn't be introduced.

  • CoffeeScript version: 2.7.0