Node: Destructuring Assignment Parse Error - works in Chrome & Safari but not Node

Created on 21 Feb 2017  路  8Comments  路  Source: nodejs/node

  • Version: v6.9.5
  • Platform: Darwin Honor.local 16.4.0 Darwin Kernel Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64 x86_64
  • Subsystem: parser

This source: a=b=1;((a + 1), {c} = b)

  • Works in Chrome 56.0.2924.87
  • Works in Safari 10.0.3 (12602.4.8)
  • Fails to parse in Node

Quick command-line test:

  • echo "a=b=1;((a + 1), {c} = b)" | node

These slight variations DO work in node:

  • a=b=1;((a), {c} = b)
  • a=b=1;((a + 1), ({c} = b))
V8 Engine confirmed-bug

All 8 comments

It also works in: Babel 6.23.1

@shanebdavis Fwiw, it also works in Node 7.x, which means it was likely fixed during a V8 upgrade.

/cc @nodejs/v8

@addaleax Thanks! That makes sense. I was wondering why it worked in Chrome and not Node.

Is 6.x scheduled to get V8 updates?

Is 6.x scheduled to get V8 updates?

Not regularly. I think the process for these cases is to look for which commit(s) in V8 fixed the problem, see if is feasible to apply them to the old V8 branch and then cherry-pick them back.

Eh I suppose we can keep the label on it if backporting is at all viable.

I Identified https://github.com/v8/v8/commit/dfb8d3331e7cb2c3e67ef820cbcb6cfbae7159e5 as the commit that fixes it using git bisect.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

filipesilvaa picture filipesilvaa  路  3Comments

ksushilmaurya picture ksushilmaurya  路  3Comments

danielstaleiny picture danielstaleiny  路  3Comments

srl295 picture srl295  路  3Comments

vsemozhetbyt picture vsemozhetbyt  路  3Comments