-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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 module specs
Summary: > **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': { 'type': 'EnumDeclaration', 'name': 'QualityEnum', '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 module specs Differential Revision: https://www.internalfb.com/diff/D42778258?entry_point=27 fbshipit-source-id: b68597ff3dd6485a604d5bffdf1c60f1d1bfa15b
- Loading branch information
1 parent
1f5976c
commit d0aec9a
Showing
20 changed files
with
861 additions
and
169 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.