From f3e3489cf868dc87ba6227ee89feb31a5394354a Mon Sep 17 00:00:00 2001 From: Arik Sosman Date: Wed, 27 Jan 2021 11:18:23 -0800 Subject: [PATCH] don't return values for void types --- typescript_strings.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/typescript_strings.py b/typescript_strings.py index 1715a54d..37aba59d 100644 --- a/typescript_strings.py +++ b/typescript_strings.py @@ -891,19 +891,21 @@ const decodeString = (stringPointer, free = true) => { method_argument_string += f"{arg_conv_info.arg_name}: {arg_conv_info.java_ty}" native_call_argument_string += native_argument + has_return_value = return_type_info.c_ty != 'void' needs_decoding = return_type_info.c_ty in self.wasm_decoding_map - return_value = 'nativeResponseValue' - if needs_decoding: + return_statement = 'return nativeResponseValue;' + if not has_return_value: + return_statement = '// debug statements here' + elif needs_decoding: converter = self.wasm_decoding_map[return_type_info.c_ty] - return_value = f"{converter}(nativeResponseValue)" + return_statement = f"return {converter}(nativeResponseValue);" out_java = f"""\texport function {method_name}({method_argument_string}): {return_type_info.java_ty} {{ if(!isWasmInitialized){{ throw new Error("initializeWasm() must be awaited first!"); }} const nativeResponseValue = wasm.{method_name}({native_call_argument_string}); - return {return_value}; - \n\t}} + {return_statement}\n\t}} \n""" -- 2.39.5