-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: D7029173 implemented basic lexer/parser support for optional chaining, based on the [Babylon implementation](babel/babylon#545) linked from the [proposal](https://github.com/tc39/proposal-optional-chaining#related-issues). However, that code is out of sync with the current specification. Babel has since [updated](babel/babel#7256) its code to fix those issues. This diff parallels those changes, which should make their way into [ESTree](estree/estree#146). Notes: * We never prohibited `delete`-ing an optional chain, so there's no need to add this back in. * D7029173 already prohibits combining optional chains with `super`, `new` expressions, and template literals. * Rather than annotating `Member` and `Call` AST nodes with an `optional` property, we have new `OptionalMember` and `OptionalCall` nodes. This makes detecting and tracking optional chains easier, and we can leverage this to track where [parentheses have curtailed short-circuiting](https://github.com/tc39/proposal-optional-chaining#edge-case-grouping). Reviewed By: mroch Differential Revision: D7380919 fbshipit-source-id: bbfaa620936bd14c7f8e06a85ae22d81b144a6d4
- Loading branch information
1 parent
24cfe90
commit 344a7c5
Showing
38 changed files
with
768 additions
and
270 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,5 @@ new B?.C?.(a, b) | |
new B?.C | ||
|
||
new B?.C() | ||
|
||
new C?.b.d() |
Oops, something went wrong.