Skip to content

[CS2] Array destructuring bug #4657

@boris-petrov

Description

@boris-petrov
x = ([a..., b]) ->
  console.log a, b

x [1, 2, 3, 4]

This produces the incorrect:

var x,
  slice = [].slice;

x = function(arg) {
  var arg, i;
  a = 2 <= arg.length ? slice.call(arg, 0, i = arg.length - 1) : (i = 0, []), b = arg[i++];
  return console.log(a, b);
};

x([1, 2, 3, 4]);

As you can see, the variable a is not defined anywhere and this blows up.

Using CoffeeScript 2.0.0-beta4.

PS. Actually b is not defined either.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions