]> git.bitcoin.ninja Git - ldk-java/commitdiff
Use explicit return type var names instead of guessing
authorMatt Corallo <git@bluematt.me>
Fri, 30 Apr 2021 02:03:14 +0000 (02:03 +0000)
committerMatt Corallo <git@bluematt.me>
Sat, 1 May 2021 00:11:31 +0000 (00:11 +0000)
gen_type_mapping.py
genbindings.py

index ba29e0af96f93136e31e634a45be8da3e2fca929..d9bcf976776754ea1a9e7521f14e78d9e83b2c07 100644 (file)
@@ -32,8 +32,6 @@ class TypeMappingGenerator:
             else:
                 arr_name = "ret"
                 arr_len = ret_arr_len
-            if arr_name == "arg":
-                arr_name = "ret"
             if ty_info.c_ty == "int8_tArray":
                 (set_pfx, set_sfx) = self.consts.set_native_arr_contents(arr_name + "_arr", arr_len, ty_info)
                 ret_conv = ("int8_tArray " + arr_name + "_arr = " + self.consts.create_native_arr_call(arr_len, ty_info) + ";\n" + set_pfx, "")
index fe0d6f74a3bf3fbb2625e043f720b027df121825..11e659277cf1586272e3edd8cabce64040b720b2 100755 (executable)
@@ -408,7 +408,7 @@ with open(sys.argv[1]) as in_h, open(sys.argv[2], "w") as out_java:
         else:
             struct_meth = method_name.split("_")[0]
 
-        return_type_info = type_mapping_generator.map_type(method_return_type, True, ret_arr_len, False, False)
+        return_type_info = type_mapping_generator.map_type(method_return_type.strip() + " ret", True, ret_arr_len, False, False)
 
         argument_types = []
         default_constructor_args = {}
@@ -545,7 +545,7 @@ with open(sys.argv[1]) as in_h, open(sys.argv[2], "w") as out_java:
 
             field_fns = []
             for fn_docs, fn_line in trait_fn_lines:
-                ret_ty_info = type_mapping_generator.map_type(fn_line.group(2), True, None, False, False)
+                ret_ty_info = type_mapping_generator.map_type(fn_line.group(2).strip() + " ret", True, None, False, False)
                 is_const = fn_line.group(4) is not None
 
                 arg_tys = []