-
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: Original Author: [email protected] Original Git: a62edf1 Original Reviewed By: alexmckenley Original Revision: D67777384 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: fbmal7 Differential Revision: D67946144 fbshipit-source-id: aedc7ab25c13231dd83b87ed729245f4f9959c48
- Loading branch information
1 parent
d6c8fe6
commit caebbb3
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