-
Notifications
You must be signed in to change notification settings - Fork 24.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add missing struct member initialization in Props.h (#44294)
Summary: Pull Request resolved: #44294 **Problem:** It was discovered while testing 3 party library, generated member variables in a C++ `struct` in `Props.h` is not initialized. Also `WithDefault` would not work as well. (For the problematic case it was a `boolean` but would also apply to other primitive types.) If there is no default initialization and the component prop is optional and the user of the native component does not set the prop then the variable is never initialized and this is problematic for primitive types in C++ where no initialization results in an undefined behavior. **Proposed solution:** (Following C++Core Guideline of [always initialize](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Res-always).) Reusing `generatePropsString()` used by `ClassTemplate` to generate props for `StructTemplate` as well. updated relevant test snapshots. This change is only concerning the `Props.h` file. **Changelog:** [General][Fixed] - fixed `Props.h` created from codegen missing default initializers in C++ `struct` Reviewed By: cipolleschi Differential Revision: D56659457 fbshipit-source-id: 0d21ad20c0491a7e8bb718cd3156da65def72f23
- Loading branch information
1 parent
59e7ed5
commit 1373951
Showing
6 changed files
with
137 additions
and
52 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
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