utils: codegen: ipc: Simplify return statements

Returning an expression of type `void` from a function returning `void`
is legal, so do not handle those cases specially.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
This commit is contained in:
Barnabás Pőcze 2025-05-13 15:00:07 +02:00
parent 4adefc100d
commit e633d85be9

View file

@ -127,13 +127,13 @@ void {{proxy_name}}::recvMessage(const IPCMessage &data)
{{proxy_funcs.func_sig(proxy_name, method)}} {{proxy_funcs.func_sig(proxy_name, method)}}
{ {
if (isolate_) if (isolate_)
{{"return " if method|method_return_value != "void"}}{{method.mojom_name}}IPC( return {{method.mojom_name}}IPC(
{%- for param in method|method_param_names -%} {%- for param in method|method_param_names -%}
{{param}}{{- ", " if not loop.last}} {{param}}{{- ", " if not loop.last}}
{%- endfor -%} {%- endfor -%}
); );
else else
{{"return " if method|method_return_value != "void"}}{{method.mojom_name}}Thread( return {{method.mojom_name}}Thread(
{%- for param in method|method_param_names -%} {%- for param in method|method_param_names -%}
{{param}}{{- ", " if not loop.last}} {{param}}{{- ", " if not loop.last}}
{%- endfor -%} {%- endfor -%}
@ -159,16 +159,14 @@ void {{proxy_name}}::recvMessage(const IPCMessage &data)
state_ = ProxyRunning; state_ = ProxyRunning;
thread_.start(); thread_.start();
{{ "return " if method|method_return_value != "void" -}} return proxy_.invokeMethod(&ThreadProxy::start, ConnectionTypeBlocking
proxy_.invokeMethod(&ThreadProxy::start, ConnectionTypeBlocking
{{- ", " if method|method_param_names}} {{- ", " if method|method_param_names}}
{%- for param in method|method_param_names -%} {%- for param in method|method_param_names -%}
{{param}}{{- ", " if not loop.last}} {{param}}{{- ", " if not loop.last}}
{%- endfor -%} {%- endfor -%}
); );
{%- elif not method|is_async %} {%- elif not method|is_async %}
{{ "return " if method|method_return_value != "void" -}} return ipa_->{{method.mojom_name}}(
ipa_->{{method.mojom_name}}(
{%- for param in method|method_param_names -%} {%- for param in method|method_param_names -%}
{{param}}{{- ", " if not loop.last}} {{param}}{{- ", " if not loop.last}}
{%- endfor -%} {%- endfor -%}