Implement the Optional Chaining operator (?.) proposal
Categories
(Core :: JavaScript Engine, enhancement, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox74 | --- | fixed |
People
(Reporter: alex.fdm, Assigned: yulia)
References
(Blocks 2 open bugs, )
Details
(Keywords: dev-doc-needed, parity-chrome, parity-safari)
Attachments
(4 files, 6 obsolete files)
The proposal is currently on Stage 2.
| Reporter | ||
Updated•1 year ago
|
Changing "Blocks" to Stage 3 per https://github.com/tc39/proposals/commit/25f8d6a4db03bcdd2cfd49bf32e312ce80e1c80e
Comment 4•5 months ago
|
||
It's implemented in both V8 and JSC now
| Reporter | ||
Updated•5 months ago
|
| Assignee | ||
Updated•3 months ago
|
| Assignee | ||
Comment 5•3 months ago
|
||
| Assignee | ||
Comment 6•3 months ago
|
||
| Assignee | ||
Comment 8•1 month ago
|
||
| Assignee | ||
Comment 9•1 month ago
|
||
Depends on D58973
| Assignee | ||
Comment 10•1 month ago
|
||
Depends on D58974
| Assignee | ||
Comment 11•1 month ago
|
||
Depends on D58975
| Assignee | ||
Comment 12•1 month ago
|
||
Depends on D58976
| Assignee | ||
Comment 13•1 month ago
|
||
Depends on D58977
| Assignee | ||
Comment 14•1 month ago
|
||
Depends on D58974
| Assignee | ||
Comment 15•1 month ago
|
||
Depends on D59869
Updated•1 month ago
|
Updated•1 month ago
|
Updated•1 month ago
|
Updated•1 month ago
|
Updated•1 month ago
|
Updated•1 month ago
|
Comment 16•1 month ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/37071f53b00b
https://hg.mozilla.org/mozilla-central/rev/35b55a5b0e4d
https://hg.mozilla.org/mozilla-central/rev/254be9b0aaee
https://hg.mozilla.org/mozilla-central/rev/5d3392ccb733
Comment 17•1 month ago
|
||
Yulia, as I started working on Bug 1594009 for console support, I wanted to check with you if it's normal for
document?.location?["origin"];
to throw a SyntaxError ? Chrome does the same, but in https://tc39.es/proposal-optional-chaining/ there are a few places where it looks like it should be possible? (I'm really not used to read specs, so I definitely can be wrong).
| Assignee | ||
Comment 18•1 month ago
|
||
Hi Nicolas,
Unfortunately, we can't use location?["origin"] because we cannot distinguish it from a ternary without a look ahead larger than one or two characters. the engine, when it sees a bare ?, it expects a ternary operator -> location ? ["origin"] : ..., which is what the syntax error refers to.
As a result, the committee settled on this syntax -> location?.["origin"] -- it isn't ideal, but it resolves the lookahead problem. if we didn't do it right away, we would have potential errors with automatic semicolon insertion, thus making it impossible for us to include it later due to web compat.
The same is true for function calls.
So, tl;dr-> yes, it should be a syntax error specifically for an incomplete ternary expression.
Comment 19•1 month ago
|
||
(In reply to Yulia Startsev [:yulia] from comment #18)
So, tl;dr-> yes, it should be a syntax error specifically for an incomplete ternary expression.
Thanks a lot for the explanation :)
Description
•