-
Notifications
You must be signed in to change notification settings - Fork 648
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve match transform logic for determining if an 'in' check is nee…
…ded for an object property's pattern Summary: The most basic example is: ``` const e = match (x) { {foo: undefined}: 0, } ``` Previously we only outputted a check that `x.foo === undefined`, but if `foo` doesn't exist, this would still pass (e.g. input `{}`). To fix this, add an `in` check in that scenario. Also properly handle As and Or Patterns. Note that since an Identifier or Member Pattern may resolve to `undefined`, we add the `in` check for all those cases. Reviewed By: alexmckenley Differential Revision: D67777384 fbshipit-source-id: 4d348f6ea306c6aee741f1d5d939fb9e17227a63
- Loading branch information
1 parent
e9b0b8e
commit a62edf1
Showing
2 changed files
with
71 additions
and
9 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