Closed Bug 454505 Opened 17 years ago Closed 16 years ago

Implement JS 1.8 destructuring assignment shorthand for Rhino

Categories

(Rhino Graveyard :: Core, enhancement)

x86
Linux
enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: hannesw, Assigned: hannesw)

References

Details

Attachments

(1 file, 3 obsolete files)

User-Agent: Mozilla/5.0 (X11; U; Linux i686; de; rv:1.9.0.1) Gecko/2008072820 Firefox/3.0.1 Build Identifier: It would be nice to have the destructuring assignment shorthand feature described in bug #404734 available in Rhino. Reproducible: Always
Implement destructuring assignment shorthand. Also adds a JS 1.8 language version constant to Context.java. The reason I'm using an instance field for inDestructuringAssignment to avoid shorhand notation to pass through in ordinary object literals is for nested assignments like "var [a, {b}] = ...". The call stack is really deep here (all the *Expr() methods) so passing this through as argument would add major overhead. Another approach would be to set a property on shorthanded name nodes and check for it later on in the interpreter/compiler like I think spidermonkey does. The decompiler still renders the long form, i.e. {f} -> {f:f}. To fix that we'd also have to set a property on the shorthanded name node.
Same patch as previous, but includes added message to Message.properties.
Attachment #337853 - Attachment is obsolete: true
Assignee: nobody → norrisboyd
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Attached patch new patch (obsolete) — Splinter Review
Updated patch to new parser code.
Attachment #338065 - Attachment is obsolete: true
add support for decompiler and minor code cleanup
Assignee: norrisboyd → hannes
Attachment #376481 - Attachment is obsolete: true
Committed last patch to CVS HEAD: Checking in src/org/mozilla/javascript/IRFactory.java; /cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/IRFactory.java,v <-- IRFactory.java new revision: 1.124; previous revision: 1.123 done Checking in src/org/mozilla/javascript/Node.java; /cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/Node.java,v <-- Node.java new revision: 1.81; previous revision: 1.80 done Checking in src/org/mozilla/javascript/Parser.java; /cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/Parser.java,v <-- Parser.java new revision: 1.138; previous revision: 1.137 done Checking in src/org/mozilla/javascript/resources/Messages.properties; /cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/resources/Messages.properties,v <-- Messages.properties new revision: 1.92; previous revision: 1.91 done
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: