Skip to content

Spread and destructor adds erroneous parenthesis. #52

@Naddiseo

Description

@Naddiseo

Test case:

var p = [];
var [a,b] = Object(...p);

Partial output:

// .... Snip....
var p = [];
var a = (b = Object.apply(null, ITER$0(p))[0], b = b[1]);

As you can see from the output, the initializer for a is wrapped in parenthesis, which causes b = b[1] to not be part of the var declaration, thus, b is never defined.

Side question: what is the reasoning behind doing the destructoring this way instead of similar to how traceur does it with a temporary?

 var p = [];
  var $__27 = Object.apply(null, $traceurRuntime.spread(p)),
      a = $__27[0],
      b = $__27[1];

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions