Implement object destructuring shorthand for JS1.8

VERIFIED FIXED in mozilla1.9beta3

Status

()

P1
normal
VERIFIED FIXED
12 years ago
5 years ago

People

(Reporter: brendan, Assigned: brendan)

Tracking

({dev-doc-complete})

Trunk
mozilla1.9beta3
dev-doc-complete
Points:
---
Dependency tree / graph
Bug Flags:
blocking1.9 +
in-testsuite +
in-litmus -

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [DocArea=JS])

Attachments

(1 attachment, 2 obsolete attachments)

(Assignee)

Description

12 years ago
var {p, q} = o;

short for

var {p:p, q:q} = o;

where o = {p: 42, q: true}.

/be
(Assignee)

Comment 1

11 years ago
Want this for JS1.8 (JS2/ES4 proving).

/be
Status: NEW → ASSIGNED
Flags: blocking1.9+
(Assignee)

Comment 2

11 years ago
Posted patch implementation (obsolete) — Splinter Review
This added side-trip is easy, if you know the territory already ;-).

/be
Attachment #295144 - Flags: review?(mrbkap)
(Assignee)

Comment 3

11 years ago
Warming up a bit with a small patch, hence elevated priority.

/be
Priority: -- → P1
Target Milestone: mozilla1.9 M10 → mozilla1.9 M11
(Assignee)

Comment 4

11 years ago
Comment on attachment 295144 [details] [diff] [review]
implementation

Incomplete, need consensus from Ecma TG1 based on http://bugs.ecmascript.org/ticket/111#comment:3.

/be
Attachment #295144 - Flags: review?(mrbkap) → review-
(Assignee)

Comment 5

11 years ago
The only forward progress to report is approval of destructuring shorthand and the desire to separate object initialiser shorthand that mirrors the destructuring shorthand into a separate bugs.ecmascript.org trac ticket. I don't favor such a "structuring" shorthand at the moment, so don't plan to implement it. Since the destructuring shorthand is approved, I would like to finish this bug by adding the necessary post-parsing AST check for lvalue context.

/be
(Assignee)

Comment 6

11 years ago
Attachment #295144 - Attachment is obsolete: true
Attachment #299869 - Flags: review?(mrbkap)
Comment on attachment 299869 [details] [diff] [review]
shorthand is for destructuring only (not "structuring" aka object literal)

I only skimmed the decompiler changes. Do those JS_ASSERTS want to be LOCAL_ASSERTs?
Attachment #299869 - Flags: review?(mrbkap) → review+
(Assignee)

Comment 8

11 years ago
Attachment #299869 - Attachment is obsolete: true
Attachment #300269 - Flags: review+
Attachment #300269 - Flags: approval1.9+
(Assignee)

Comment 9

11 years ago
Fixed:

js/src/js.msg 3.83
js/src/jsconfig.h 3.46
js/src/jsemit.c 3.299
js/src/jsopcode.c 3.285
js/src/jsparse.c 3.331
js/src/jsparse.h 3.58

/be
Status: ASSIGNED → RESOLVED
Last Resolved: 11 years ago
Resolution: --- → FIXED

Comment 10

11 years ago
/cvsroot/mozilla/js/tests/js1_8/regress/regress-404734.js,v  <--  regress-404734.js
initial revision: 1.1
Flags: in-testsuite+
Flags: in-litmus-

Comment 11

11 years ago
v
Status: RESOLVED → VERIFIED

Updated

7 years ago
Keywords: dev-doc-needed
Finally put together https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment which contains info on destructuring in the light of ES6.

Marking this as dev-doc-complete.
Keywords: dev-doc-needed → dev-doc-complete
You need to log in before you can comment on or make changes to this bug.