Closed Bug 1255167 Opened 8 years ago Closed 8 years ago

Default object arguments are not defined as lexical dependencies.

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla50
Tracking Status
firefox50 --- fixed

People

(Reporter: stefan, Assigned: mrrrgn)

References

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.75 Safari/537.36

Steps to reproduce:

Define the following function:
f = function(a){ (function({aa = a}){ console.log('result: ' + aa); })({}); }
invoke it
f(42)


Actual results:

ReferenceError: a is not defined


Expected results:

console log: result: 42
Component: Untriaged → JavaScript Engine
Product: Firefox → Core
maybe similar issue to bug 1126361
Blocks: 932080
Status: UNCONFIRMED → NEW
Ever confirmed: true
See Also: → 1126361
The right hand side of the destructuring assignment isn't being added to pc->lexdeps. Adding it will ensure that it is defined in the inner function's scope via Parser::leaveFunction

Coming up with a patch for this in a jiffy.
Assignee: nobody → winter2718
Summary: Function parameter gets optimized away when used as the default of a named parameter only → Default object arguments are not defined as lexical dependencies.
Attachment #8760939 - Flags: review?(jorendorff)
Attachment #8760939 - Flags: review?(jorendorff) → review+
Pushed by mphillips@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/095c359e97ad
Default destructuring arguments should show up as lexical dependencies; r=jorendorff
https://hg.mozilla.org/mozilla-central/rev/095c359e97ad
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla50
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: