This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 246773

Summary: Language: Javascript. Handling of Destructuring assignment as warning instead of error
Product: javascript Reporter: oriberu
Component: EditorAssignee: Petr Pisl <ppisl>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 8.0   
Hardware: PC   
OS: Windows 7   
URL: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment
Issue Type: ENHANCEMENT Exception Reporter:

Description oriberu 2014-08-29 11:42:28 UTC
Product Version = NetBeans IDE 8.0 (Build 201403101706)
Operating System = Windows 7 version 6.1 running on x86
Java; VM; Vendor = 1.8.0_20
Runtime = Java HotSpot(TM) Client VM 25.20-b23

It would be nice if Destructuring assignments (supported by Mozilla since 2006, example and link below) 
would at least not be marked as an error by the editor's hint system. A warning would probably be more 
appropriate.

Documentation:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment

Example:
[foo, bar] = "1,2".split(','); // foo=1, bar=2
[foo, bar] = "34"; // foo=3, bar=4
[foo, bar] = [5,6]; // foo=5, bar=6

[foo, bar] = "1,2,3".split(','); // foo=1, bar=2, discards 3
[foo,, bar] = "1,2,3".split(','); // foo=1, discards 2, bar=3

Thanks.
Comment 1 Petr Pisl 2014-11-05 15:57:06 UTC
This is problem of the Nashorn parser. We need to alter the parser itself or push Nashorn developer team to integrate this to the Nashorn.