Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[codegen] move remapUnionTypeAnnotationMemberNames to Parser #35314

Conversation

youedd
Copy link
Contributor

@youedd youedd commented Nov 11, 2022

Summary

Part of #34872 (comment)

[Assigned to @youedd] Create a new function remapUnionTypeAnnotationMemberNames in the parser.js file and add documentation to it. Implement it properly in the FlowParser.js and in the TypeScriptParser.js. Remove the function remapUnionTypeAnnotationMemberNames and update the emitUnionTypeAnnotation signature to accept a Parser parameter instead of a language one. Use the new Parser function instead of the old one here.

Changelog

[Internal] [changed] - move remapUnionTypeAnnotationMemberNames to the parsers implementations

Test Plan

yarn jest react-native-codegen

image

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 11, 2022
@youedd youedd force-pushed the chore/refactor-remap-union-type-annotation-member-names branch from 0c4c05f to ca1a85e Compare November 11, 2022 17:10
@analysis-bot
Copy link

analysis-bot commented Nov 11, 2022

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 7,100,944 +0
android hermes armeabi-v7a 6,470,646 +0
android hermes x86 7,518,793 +0
android hermes x86_64 7,377,397 +0
android jsc arm64-v8a 8,965,032 +0
android jsc armeabi-v7a 7,696,430 +0
android jsc x86 9,027,537 +0
android jsc x86_64 9,505,668 +0

Base commit: f657d29
Branch: main

@analysis-bot
Copy link

analysis-bot commented Nov 11, 2022

Platform Engine Arch Size (bytes) Diff
ios - universal n/a --

Base commit: f657d29
Branch: main

@pull-bot
Copy link

PR build artifact for ca1a85e is ready.
To use, download tarball from "Artifacts" tab in this CircleCI job then run yarn add <path to tarball> in your React Native project.

@pull-bot
Copy link

PR build artifact for ca1a85e is ready.
To use, download tarball from "Artifacts" tab in this CircleCI job then run yarn add <path to tarball> in your React Native project.

Copy link
Contributor

@cipolleschi cipolleschi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this, it looks very good to me! :D

@cipolleschi
Copy link
Contributor

Could you rebase to solve conflicts? 🙏

@facebook-github-bot
Copy link
Contributor

@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@youedd youedd force-pushed the chore/refactor-remap-union-type-annotation-member-names branch from ca1a85e to 9aac210 Compare November 12, 2022 18:09
@youedd
Copy link
Contributor Author

youedd commented Nov 12, 2022

@cipolleschi it's rebased !

@pull-bot
Copy link

PR build artifact for 9aac210 is ready.
To use, download tarball from "Artifacts" tab in this CircleCI job then run yarn add <path to tarball> in your React Native project.

@pull-bot
Copy link

PR build artifact for 9aac210 is ready.
To use, download tarball from "Artifacts" tab in this CircleCI job then run yarn add <path to tarball> in your React Native project.

@facebook-github-bot
Copy link
Contributor

@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

OlimpiaZurek pushed a commit to OlimpiaZurek/react-native that referenced this pull request May 22, 2023
Summary:
Part of facebook#34872 (comment)

> [Assigned to youedd] Create a new function [remapUnionTypeAnnotationMemberNames](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/parsers-commons.js#L110) in the [parser.js file](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/parser.js) and add documentation to it. Implement it properly in the [FlowParser.js](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/flow/parser.js#L15) and in the [TypeScriptParser.js](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/typescript/parser.js#L15). Remove the function [remapUnionTypeAnnotationMemberNames](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/parsers-commons.js#L110) and update the [emitUnionTypeAnnotation](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/parsers-commons.js#L110) signature to accept a Parser parameter instead of a language one. Use the new Parser function instead of the old one [here](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/parsers-commons.js#L139).

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[Internal] [changed] - move remapUnionTypeAnnotationMemberNames to the parsers implementations

Pull Request resolved: facebook#35314

Test Plan:
`yarn jest react-native-codegen`

![image](https://user-images.githubusercontent.com/19575877/201389910-31d48601-7023-4c94-a6d5-efccb18629cd.png)

Reviewed By: christophpurrer

Differential Revision: D41247716

Pulled By: cipolleschi

fbshipit-source-id: 6f708895392d5bdac5d4edbc67587194321ddb3d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants