From 6b671d81019a31dd27e5c0c43da5c7f3f79ac7f3 Mon Sep 17 00:00:00 2001 From: tarrinneal Date: Mon, 7 Aug 2023 23:11:18 -0700 Subject: [PATCH] fdjslkj --- packages/pigeon/lib/cpp_generator.dart | 10 +++++----- .../test_plugin/windows/pigeon/core_tests.gen.cpp | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/pigeon/lib/cpp_generator.dart b/packages/pigeon/lib/cpp_generator.dart index 6fc9fae3717e..1cc3dc228172 100644 --- a/packages/pigeon/lib/cpp_generator.dart +++ b/packages/pigeon/lib/cpp_generator.dart @@ -979,11 +979,11 @@ class CppSourceGenerator extends StructuredGenerator { argName: argName, encodableArgName: encodableArgName, ); - // final String unwrapEnum = - // isEnum(root, arg.type) && arg.type.isNullable - // ? '.value()' - // : ''; - methodArgument.add(argName); + final String unwrapEnum = + isEnum(root, arg.type) && arg.type.isNullable + ? ' ? &(*$argName) : nullptr' + : ''; + methodArgument.add('$argName$unwrapEnum'); }); } diff --git a/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.cpp b/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.cpp index 0facc5895595..00b831d42e6b 100644 --- a/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.cpp +++ b/packages/pigeon/platform_tests/test_plugin/windows/pigeon/core_tests.gen.cpp @@ -1733,8 +1733,8 @@ void HostIntegrationCoreApi::SetUp(flutter::BinaryMessenger* binary_messenger, an_enum_arg = std::make_optional( std::get(encodable_an_enum_arg)); } - ErrorOr> output = - api->EchoNullableEnum(an_enum_arg); + ErrorOr> output = api->EchoNullableEnum( + an_enum_arg ? &(*an_enum_arg) : nullptr); if (output.has_error()) { reply(WrapError(output.error())); return;