Skip to content

Commit 3a51335

Browse files
committed
Remove args_known and fix (void) parsing (duh, its no arguments)
1 parent 5dc21ae commit 3a51335

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

genbindings.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,6 @@ def map_fn_with_ref_option(line, re_match, ret_arr_len, c_call_string, doc_comme
551551
default_constructor_args = {}
552552
takes_self = False
553553
takes_self_ptr = False
554-
args_known = True
555554

556555
for argument_index, argument in enumerate(method_arguments):
557556
arg_ty = type_mapping_generator.java_c_types(argument, None)
@@ -585,13 +584,12 @@ def map_fn_with_ref_option(line, re_match, ret_arr_len, c_call_string, doc_comme
585584
if argument_conversion_info.arg_conv is not None and "WARNING" in argument_conversion_info.arg_conv:
586585
if argument_conversion_info.rust_obj in constructor_fns:
587586
assert not is_free
588-
for explode_arg in constructor_fns[argument_conversion_info.rust_obj].split(','):
587+
for explode_idx, explode_arg in enumerate(constructor_fns[argument_conversion_info.rust_obj].split(',')):
589588
explode_arg_conv = type_mapping_generator.map_type(explode_arg, False, None, False, True)
589+
if explode_idx == 0 and explode_arg_conv.c_ty == "void":
590+
continue # (void) is C lingo for "no arguments)
590591
if explode_arg_conv.c_ty == "void":
591-
# We actually want to handle this case, but for now its only used in NetGraphMsgHandler::new()
592-
# which ends up resulting in a redundant constructor - both without arguments for the NetworkGraph.
593-
args_known = False
594-
pass
592+
assert False
595593
if not argument_conversion_info.arg_name in default_constructor_args:
596594
default_constructor_args[argument_conversion_info.arg_name] = []
597595
default_constructor_args[argument_conversion_info.arg_name].append(explode_arg_conv)
@@ -625,6 +623,7 @@ def map_fn_with_ref_option(line, re_match, ret_arr_len, c_call_string, doc_comme
625623
arg.from_hu_conv = (arg.from_hu_conv[0], "")
626624

627625
out_java.write("\t// " + line)
626+
args_known = True # We no longer ever set this to false
628627
(out_java_delta, out_c_delta, out_java_struct_delta) = \
629628
consts.map_function(argument_types, c_call_string, method_name, struct_meth_name, return_type_info, struct_meth, default_constructor_args, takes_self, takes_self_ptr, args_known, type_mapping_generator, doc_comment)
630629
out_java.write(out_java_delta)

0 commit comments

Comments
 (0)