| Summary: | [occurences] Destructuring assignments do not work correctly | ||
|---|---|---|---|
| Product: | [ECD] Orion | Reporter: | Michael Rennie <Michael_Rennie> |
| Component: | JS Tools | Assignee: | Michael Rennie <Michael_Rennie> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | unspecified | ||
| Target Milestone: | 13.0 | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
Consider the following examples of destructuring array assignments. Occurrences does not work properly for any of the identifiers in the LHS of the assignment expression. //Simple var [a, b] = [1, 2]; if(a === 10 || b === 10) { } //External decl var c, d; [c, d] = [3, 4]; if(c === 10 || d === 10) { } //Reassignment var e = [5, 6]; var [f, g] = e; if(f === 10 || g === 10) { } //Default values var [h=1, i=2] = [3, 4]; if(h === 10 || i === 10) { } //Value swap var j = 2, k = 3; [j, k] = [k, j]; //Ignoring values [l, ,n] = [1, 2, 3, 4, 5]; if(l === 10 || n === 10) { } Now consider the following examples of object destructuring assignment: /*eslint-env browser */ //Simple var {a, b} = {a: 1, b:2}; if(a || b) { } //Assign without decl var c, d; ({c, d} = {c:1, d:2}); //Default values var {e=10, f=5} = {e: 3}; //Function defaults (function fun({aa = 1, bb = { x: 0, y: 0 }, cc = 2} = {}) { console.log(aa, bb, cc); })(); //For of var g = {aaa: 'a', bbb: {ccc: 'b'}}; for (var {aaa: a1, bbb: { ccc: c1 } } of g) { console.log(a1, c1); } //Computed property names let key = "z"; let { [key]: h } = { z: "bar" };