Meta: Fix IPC generated try helper response unwrapping

Generated try_* proxy methods for synchronous messages with a single
output declared IPCErrorOr<T>, but returned the whole response object
instead of the output payload. That made helpers with named bool
responses unusable once callers started using the fallible path.

Share the same single-output accessor logic used by the infallible sync
helpers so fallible generated helpers return the declared payload type.
This commit is contained in:
Aliaksandr Kalenik 2026-05-24 03:36:18 +02:00 committed by Alexander Kalenik
parent f607af9ff3
commit 1201015ab8

View file

@ -503,9 +503,17 @@ def write_proxy_method(
else:
out.write(f"\n return move(*{sync_call});")
elif is_try:
if inner_return_type == "void":
success_return = "{}"
elif len(message.outputs) == 1:
output = message.outputs[0]
accessor = output.name if is_primitive_or_simple_type(output.type) else f"take_{output.name}"
success_return = f"result->{accessor}()"
else:
success_return = "move(*result)"
out.write(f"""
if (auto result = m_connection.template send_sync_but_allow_failure<Messages::{endpoint.name}::{pascal_name}>({call_args}))
return {"{}" if inner_return_type == "void" else "move(*result)"};
return {success_return};
m_connection.shutdown();
return IPC::ErrorCode::PeerDisconnected;""")
else: