Files
react-native/packages/react-native-codegen
Ramanpreet Nara 898f73deef Introduce visit(ast, visitor) utility
Summary:
In the Codegen, we need to answer the following questions:

*Question:* What are all the calls into TurboModuleRegistry?
*Answer:* Find all CallExpressions that represent TurboModuleRegistry.get<Spec>() or TurboModuleRegisty.getEnforcing<Spec>().

*Question:* Is this a component spec?
*Answer:* Does this spec have a CallExpression where the callee is 'codegenNativeComponent'?

*Question:* Is this a module spec?
*Answer:* Does this spec have an interface that extends TurboModule?

All these answers can be implemented using the visitor pattern. Hence, this diff introduces the `visit` utility, and uses it to answer these questions.

**Motivation:** Cleaner code.

Changelog: [Internal]

Reviewed By: hramos

Differential Revision: D25162617

fbshipit-source-id: 66ec95fc07ecb29aa9bf9993cb826204af283d03
2020-12-04 14:21:53 -08:00
..
2020-12-04 14:21:53 -08:00
2020-09-29 14:39:40 -07:00

react-native-codegen

Version

Installation

yarn add --dev react-native-codegen

Note: We're using yarn to install deps. Feel free to change commands to use npm 3+ and npx if you like