-
Notifications
You must be signed in to change notification settings - Fork 24.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Parse and collect enum members in turbo module specs (#36044)
Summary: Pull Request resolved: #36044 > **Notice**: This commit does not change any behaviour. Parse and collect enum members in module specs instead of the current behaviour of parsing enum members as 'string' / 'number' and ignoring the member names. This commit would allow us to generate native Enums corresponding to the schema's enums. Prior to this commit, enum params were parsed as: ``` { 'name': 'qualityParam', 'optional': false, 'typeAnnotation': { 'type': 'EnumDeclaration', 'memberType': 'StringTypeAnnotation' } }, ``` The name of the enum type and the members of the enum type were ignored. After this commit, parsed modules would hold a new object member called `enumMap` that would look like this: ``` 'enumMap': { 'QualityEnum': { 'name': 'QualityEnum', 'type': 'EnumDeclarationWithMembers', 'memberType': 'StringTypeAnnotation', 'members': [ { 'name': 'SD', 'value': 'sd' }, { 'name': 'HD', 'value': 'hd' } ] }, // ... } ``` And enum params would be exported as: ``` { 'name': 'qualityParam', 'optional': false, 'typeAnnotation': { 'name': 'NativeModuleEnumTypeAnnotation', 'type': 'EnumDeclaration', 'memberType': 'StringTypeAnnotation' } }, ``` Combining the two new outputs would allow us to generate Native enums in the Native generators. Changelog: [Internal] Parse and collect enum members in turbo module specs Reviewed By: cipolleschi Differential Revision: D42778258 fbshipit-source-id: 56479342e085bc4e13c5a3e12b265b140e49893c
- Loading branch information
1 parent
53c9786
commit 39bdb34
Showing
20 changed files
with
999 additions
and
170 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
Oops, something went wrong.