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 258664 - Support of destructuring assignment
Summary: Support of destructuring assignment
Status: RESOLVED FIXED
Alias: None
Product: javascript
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.2
Hardware: PC Linux
: P2 normal (vote)
Assignee: Petr Pisl
URL:
Keywords:
Depends on:
Blocks: 242387
  Show dependency tree
 
Reported: 2016-04-05 15:00 UTC by Petr Pisl
Modified: 2016-04-19 09:23 UTC (History)
0 users

See Also:
Issue Type: TASK
Exception Reporter:


Attachments
Simple Array Destructuring Assignment (61.31 KB, image/png)
2016-04-19 08:41 UTC, Petr Pisl
Details
Array Destructuring Assignment with Default Values (58.81 KB, image/png)
2016-04-19 08:45 UTC, Petr Pisl
Details
Array Destructuring Assignment from a Function (60.60 KB, image/png)
2016-04-19 08:48 UTC, Petr Pisl
Details
Array Destructuring Assignment - swap values of two variables (51.32 KB, image/png)
2016-04-19 08:49 UTC, Petr Pisl
Details
Simple Object Destructuring Assignment (60.65 KB, image/png)
2016-04-19 08:51 UTC, Petr Pisl
Details
Object destructuring assignment without declaration (61.28 KB, image/png)
2016-04-19 08:54 UTC, Petr Pisl
Details
Object destructuring assignment without declaration (63.36 KB, image/png)
2016-04-19 08:57 UTC, Petr Pisl
Details
Object destructuring assignment , when a property is not defined (73.44 KB, image/png)
2016-04-19 09:04 UTC, Petr Pisl
Details
Object destructuring assigning to new variable names (73.15 KB, image/png)
2016-04-19 09:11 UTC, Petr Pisl
Details
Setting a function parameter's default value (144.01 KB, image/png)
2016-04-19 09:15 UTC, Petr Pisl
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Pisl 2016-04-05 15:00:15 UTC
NetBeans should be able to handle destructuring assignment in the right way. 

https://developer.mozilla.org/cs/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment

Currently there are false hints and mark occurrences works in wrong way in cases like:

({a, b} = {a:1, b:2});
Comment 1 Petr Pisl 2016-04-13 16:00:26 UTC
Simple array destructuring assignment is handled by NB now.
Comment 2 Petr Pisl 2016-04-19 08:41:51 UTC
Created attachment 159315 [details]
Simple Array Destructuring Assignment

Simple array destructuring assignment. Variables are created, mark occurrences and Go To declaration should work.
Comment 3 Petr Pisl 2016-04-19 08:45:08 UTC
Created attachment 159316 [details]
Array Destructuring Assignment with Default Values

According the default values NB can suggest the tape of object.
Comment 4 Petr Pisl 2016-04-19 08:48:24 UTC
Created attachment 159317 [details]
Array Destructuring Assignment from a Function
Comment 5 Petr Pisl 2016-04-19 08:49:21 UTC
Created attachment 159318 [details]
Array Destructuring Assignment - swap values of two variables

Mark occurrences should work as expected.
Comment 6 Petr Pisl 2016-04-19 08:51:57 UTC
Created attachment 159319 [details]
Simple Object Destructuring Assignment

Creating variables, mark occurrences and Go To navigation should work.
Comment 7 Petr Pisl 2016-04-19 08:54:52 UTC
Created attachment 159320 [details]
Object destructuring assignment without declaration
Comment 8 Petr Pisl 2016-04-19 08:57:41 UTC
Created attachment 159321 [details]
Object destructuring assignment without declaration

Mark occurrences should work on both sides.
Comment 9 Petr Pisl 2016-04-19 09:04:42 UTC
Created attachment 159322 [details]
Object destructuring assignment , when a property is not defined

In this case, the property from the assigned object literal corresponds with the properties on the left site of the assignment. Mark occurrences work for such properties, user can rename them. 

Also the property w is not defined on the right site, so NetBeans doesn't mark such property with green color.
Comment 10 Petr Pisl 2016-04-19 09:11:12 UTC
Created attachment 159323 [details]
Object destructuring assigning to new variable names

NetBeans marks occurrences of the properties assigned from the object literal on the right sight and the properties used on the left site.
Comment 11 Petr Pisl 2016-04-19 09:15:14 UTC
Created attachment 159324 [details]
Setting a function parameter's default value

NetBeans handle parameters defined via destructuring assignment. The mark occurrences, Go To Declaration and code completion should work in such cases.
Comment 12 Petr Pisl 2016-04-19 09:23:29 UTC
The support is done. Implemented in ecma6-truffle branch. There is an issue #258901  with false warnings that will be fixed soon.