[pigeon] primitive enums#4580
Conversation
2d84e30 to
47a2512
Compare
0f05d58 to
6958a07
Compare
9de8e12 to
58931a1
Compare
stuartmorgan-g
left a comment
There was a problem hiding this comment.
Nice! Various nits and suggestions, but it's really great to see comprehensive enum support.
stuartmorgan-g
left a comment
There was a problem hiding this comment.
LGTM!
(The more I see FooEnumBox the less I like that suggestion, but I still don't have a better idea. I'll just take comfort in the fact that nullable enums will probably be rare, and ObjC generation is likely decreasing, so the intersection should be rare and shrinking.)
| } else { | ||
| indent.writeln('std::optional<${hostType.datatype}> $argName;'); | ||
| indent.writeln( | ||
| 'const std::optional<${hostType.datatype}> $argName = $encodableArgName.IsNull() ? std::optional<${hostType.datatype}>() : std::make_optional<${hostType.datatype}>(static_cast<${hostType.datatype}>(${argName}_value));'); |
There was a problem hiding this comment.
Can std::optional<${hostType.datatype}>() just be std::nullopt? I think that works in ternaries.
There was a problem hiding this comment.
It didn't work when I tried it in this context, but it's possible I had a different issue.
better or worse than wrapper? |
stuartmorgan-g
left a comment
There was a problem hiding this comment.
New changes also LGTM. Thanks for fixing that existing missing prefix issue; I'm surprised/embarassed I didn't notice it when doing conversions.
Adds support for enums as parameters and return types.
Dart, C++, Java, Kotlin, Objective-C, and swift:
Primitive synchronous non-null
Primitive synchronous nullable
Primitive asynchronous non-null
Primitive asynchronous nullable
Primitive Flutter api non-null
Primitive flutter api nullable
Objective-C:
Class property nullable
Also fixes an issue with nullable enums in classes on objc. This fix required a breaking change that nested all nullable enums in a wrapper class to allow nullability.
Also adds the ability to format files before tests run (to make my life better)
Also replaces #4756
Also adds objc prefixes to enums
fixes: flutter/flutter#87307
fixes: flutter/flutter#118733