Skip to content

Default initialize properties in custom structs #52677

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,8 @@ struct Bridging<NativeEnumTurboModuleStatusStrEnum> {

template <typename P0>
struct NativeEnumTurboModuleStateType {
P0 state;
P0 state{};

bool operator==(const NativeEnumTurboModuleStateType &other) const {
return state == other.state;
}
Expand Down Expand Up @@ -389,11 +390,12 @@ struct NativeEnumTurboModuleStateTypeBridging {

template <typename P0, typename P1, typename P2, typename P3, typename P4>
struct NativeEnumTurboModuleStateTypeWithEnums {
P0 state;
P1 regular;
P2 str;
P3 num;
P4 lowerCase;
P0 state{};
P1 regular{};
P2 str{};
P3 num{};
P4 lowerCase{};

bool operator==(const NativeEnumTurboModuleStateTypeWithEnums &other) const {
return state == other.state && regular == other.regular && str == other.str && num == other.num && lowerCase == other.lowerCase;
}
Expand Down Expand Up @@ -862,8 +864,9 @@ private:

template <typename P0, typename P1>
struct NativePartialAnnotationTurboModuleSomeObj {
P0 a;
P1 b;
P0 a{};
P1 b{};

bool operator==(const NativePartialAnnotationTurboModuleSomeObj &other) const {
return a == other.a && b == other.b;
}
Expand Down Expand Up @@ -1055,7 +1058,8 @@ private:

template <typename P0>
struct NativeSampleTurboModuleAnimal {
P0 name;
P0 name{};

bool operator==(const NativeSampleTurboModuleAnimal &other) const {
return name == other.name;
}
Expand Down Expand Up @@ -1257,7 +1261,8 @@ private:

template <typename P0>
struct NativeSampleTurboModuleArraysAnimal {
P0 name;
P0 name{};

bool operator==(const NativeSampleTurboModuleArraysAnimal &other) const {
return name == other.name;
}
Expand Down Expand Up @@ -1459,7 +1464,8 @@ private:

template <typename P0>
struct NativeSampleTurboModuleNullableAnimal {
P0 name;
P0 name{};

bool operator==(const NativeSampleTurboModuleNullableAnimal &other) const {
return name == other.name;
}
Expand Down Expand Up @@ -1661,7 +1667,8 @@ private:

template <typename P0>
struct NativeSampleTurboModuleNullableAndOptionalAnimal {
P0 name;
P0 name{};

bool operator==(const NativeSampleTurboModuleNullableAndOptionalAnimal &other) const {
return name == other.name;
}
Expand Down Expand Up @@ -1865,7 +1872,8 @@ private:

template <typename P0>
struct NativeSampleTurboModuleOptionalAnimal {
P0 name;
P0 name{};

bool operator==(const NativeSampleTurboModuleOptionalAnimal &other) const {
return name == other.name;
}
Expand Down Expand Up @@ -2478,7 +2486,8 @@ struct Bridging<NativeEnumTurboModuleStatusStrEnum> {

template <typename P0>
struct NativeEnumTurboModuleStateType {
P0 state;
P0 state{};

bool operator==(const NativeEnumTurboModuleStateType &other) const {
return state == other.state;
}
Expand Down Expand Up @@ -2519,11 +2528,12 @@ struct NativeEnumTurboModuleStateTypeBridging {

template <typename P0, typename P1, typename P2, typename P3, typename P4>
struct NativeEnumTurboModuleStateTypeWithEnums {
P0 state;
P1 regular;
P2 str;
P3 num;
P4 lowerCase;
P0 state{};
P1 regular{};
P2 str{};
P3 num{};
P4 lowerCase{};

bool operator==(const NativeEnumTurboModuleStateTypeWithEnums &other) const {
return state == other.state && regular == other.regular && str == other.str && num == other.num && lowerCase == other.lowerCase;
}
Expand Down Expand Up @@ -2992,8 +3002,9 @@ private:

template <typename P0, typename P1>
struct NativePartialAnnotationTurboModuleSomeObj {
P0 a;
P1 b;
P0 a{};
P1 b{};

bool operator==(const NativePartialAnnotationTurboModuleSomeObj &other) const {
return a == other.a && b == other.b;
}
Expand Down Expand Up @@ -3185,7 +3196,8 @@ private:

template <typename P0>
struct NativeSampleTurboModuleAnimal {
P0 name;
P0 name{};

bool operator==(const NativeSampleTurboModuleAnimal &other) const {
return name == other.name;
}
Expand Down Expand Up @@ -3387,7 +3399,8 @@ private:

template <typename P0>
struct NativeSampleTurboModuleArraysAnimal {
P0 name;
P0 name{};

bool operator==(const NativeSampleTurboModuleArraysAnimal &other) const {
return name == other.name;
}
Expand Down Expand Up @@ -3589,7 +3602,8 @@ private:

template <typename P0>
struct NativeSampleTurboModuleNullableAnimal {
P0 name;
P0 name{};

bool operator==(const NativeSampleTurboModuleNullableAnimal &other) const {
return name == other.name;
}
Expand Down Expand Up @@ -3791,7 +3805,8 @@ private:

template <typename P0>
struct NativeSampleTurboModuleNullableAndOptionalAnimal {
P0 name;
P0 name{};

bool operator==(const NativeSampleTurboModuleNullableAndOptionalAnimal &other) const {
return name == other.name;
}
Expand Down Expand Up @@ -3995,7 +4010,8 @@ private:

template <typename P0>
struct NativeSampleTurboModuleOptionalAnimal {
P0 name;
P0 name{};

bool operator==(const NativeSampleTurboModuleOptionalAnimal &other) const {
return name == other.name;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ function createStructsString(

template <${templateParameterWithTypename}>
struct ${structName} {
${templateMemberTypes.map(v => ' ' + v).join(';\n')};
${templateMemberTypes.map(v => ' ' + v + '{};\n').join('')}
bool operator==(const ${structName} &other) const {
return ${value.properties
.map(v => `${v.name} == other.${v.name}`)
Expand Down
Loading
Loading