argument_types = []
default_constructor_args = {}
takes_self = False
+ takes_self_ptr = False
args_known = True
for argument_index, argument in enumerate(method_arguments):
argument_conversion_info = type_mapping_generator.map_type(argument, False, None, is_free, True)
if argument_index == 0 and argument_conversion_info.java_hu_ty == struct_meth:
takes_self = True
+ if argument_conversion_info.ty_info.is_ptr:
+ takes_self_ptr = True
if argument_conversion_info.arg_conv is not None and "Warning" in argument_conversion_info.arg_conv:
if argument_conversion_info.rust_obj in constructor_fns:
assert not is_free
out_java.write("\t// " + line)
(out_java_delta, out_c_delta, out_java_struct_delta) = \
- consts.map_function(argument_types, c_call_string, method_name, return_type_info, struct_meth, default_constructor_args, takes_self, args_known, type_mapping_generator, doc_comment)
+ consts.map_function(argument_types, c_call_string, method_name, return_type_info, struct_meth, default_constructor_args, takes_self, takes_self_ptr, args_known, type_mapping_generator, doc_comment)
out_java.write(out_java_delta)
if is_free:
return out_opaque_struct_human
- def map_function(self, argument_types, c_call_string, method_name, return_type_info, struct_meth, default_constructor_args, takes_self, args_known, type_mapping_generator, doc_comment):
+ def map_function(self, argument_types, c_call_string, method_name, return_type_info, struct_meth, default_constructor_args, takes_self, takes_self_as_ref, args_known, type_mapping_generator, doc_comment):
out_java = ""
out_c = ""
out_java_struct = None
for idx, arg in enumerate(argument_types):
if idx != 0:
if not takes_self or idx > 1:
- out_java_struct += (", ")
+ out_java_struct += ", "
elif takes_self:
continue
if arg.java_ty != "void":
else:
out_java_struct += ("\t\t" + info.from_hu_conv[1].replace("\n", "\n\t\t") + ";\n")
+ if takes_self and not takes_self_as_ref:
+ out_java_struct += "\t\t" + argument_types[0].from_hu_conv[1].replace("\n", "\n\t\t").replace("this_arg", "this") + ";\n"
if return_type_info.to_hu_conv_name is not None:
out_java_struct += ("\t\treturn " + return_type_info.to_hu_conv_name + ";\n")
elif return_type_info.java_ty != "void" and return_type_info.rust_obj != "LDK" + struct_meth:
"""
return out_opaque_struct_human
- def map_function(self, argument_types, c_call_string, method_name, return_type_info, struct_meth, default_constructor_args, takes_self, args_known, type_mapping_generator, doc_comment):
+ def map_function(self, argument_types, c_call_string, method_name, return_type_info, struct_meth, default_constructor_args, takes_self, takes_self_as_ref, args_known, type_mapping_generator, doc_comment):
out_java = ""
out_c = ""
out_java_struct = None