Closed
Bug 1455179
Opened 5 years ago
Closed 5 years ago
Don't warn about undefined properties when destructuring with default values
Categories
(Core :: JavaScript Engine, enhancement, P3)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla61
Tracking | Status | |
---|---|---|
firefox61 | --- | fixed |
People
(Reporter: kmag, Assigned: kmag)
References
Details
Attachments
(1 file)
These warnings come up all the time in our test output. When we destructure with a default value for a missing property, e.g.: let obj = {}; let {foo = 0} = obj; We get an undefined property warning for `obj.foo`, even though we provide a default value for it. The NativeObject Detecting checks should handle this case, and treat that as a valid detection access.
Comment hidden (mozreview-request) |
Comment 2•5 years ago
|
||
Jason, do you think we should ignore the "undefined property" warnings when destructing objects?
Flags: needinfo?(jorendorff)
Comment 3•5 years ago
|
||
If this patch lands, bug 1300416 can be closed, too.
Assignee | ||
Comment 4•5 years ago
|
||
(In reply to Nicolas B. Pierron [:nbp] {backlog: ~36} from comment #2) > Jason, do you think we should ignore the "undefined property" warnings when > destructing objects? To be clear, this only ignores properties that have default values. I.e., let {foo = 0, bar} = {}; will warn for `bar` but not `foo`.
Comment 5•5 years ago
|
||
mozreview-review |
Comment on attachment 8969150 [details] Bug 1455179: Support destructuring with default values in undefined property detection checks. https://reviewboard.mozilla.org/r/237866/#review244164 Thanks for this patch, it does fix some missing corner cases implied by the original comments.
Attachment #8969150 -
Flags: review?(nicolas.b.pierron) → review+
Updated•5 years ago
|
Flags: needinfo?(jorendorff)
Updated•5 years ago
|
Priority: -- → P3
Assignee | ||
Comment 6•5 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/219afe052ae3a80b1da61d60ade56d73af0b0ca2 Bug 1455179: Support destructuring with default values in undefined property detection checks. r=nbp
Comment 7•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/219afe052ae3
Status: NEW → RESOLVED
Closed: 5 years ago
status-firefox61:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla61
Comment 9•5 years ago
|
||
Too late, but yes, this was the right call.
You need to log in
before you can comment on or make changes to this bug.
Description
•