Skip to content

Commit 397647b

Browse files
committed
fix swift_type errors arising from expanded test
1 parent 7863d61 commit 397647b

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

src/generators/tuple_generator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def generate_tuple(self, tuple_name, tuple_details):
5959
'''
6060
native_call_prep += current_prep
6161

62-
swift_arguments.append(f'{current_argument_details.java_hu_ty} {argument_name}')
62+
swift_arguments.append(f'{current_argument_details.swift_type} {argument_name}')
6363
native_arguments.append(f'{passed_argument_name}')
6464

6565
current_replacement = current_replacement.replace('swift_arguments', ', '.join(swift_arguments))

src/lightning_header_parser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ class LightningHeaderParser():
2929

3030
@classmethod
3131
def get_file(cls) -> str:
32-
# header_path = f'{os.path.dirname(__file__)}/../input/lightning.h'
32+
header_path = f'{os.path.dirname(__file__)}/../input/lightning.h'
3333
# header_path = f'{os.path.dirname(__file__)}/../input/minimal_opaque_struct.h'
3434
# header_path = f'{os.path.dirname(__file__)}/../input/minimal_tuple.h'
35-
header_path = f'{os.path.dirname(__file__)}/../input/minimal_ping.h'
35+
# header_path = f'{os.path.dirname(__file__)}/../input/minimal_ping.h'
3636
with open(header_path, 'r') as lightning_header_handle:
3737
lightning_header = lightning_header_handle.read()
3838
return lightning_header

src/swift_type_mapper.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,14 @@ def map_types_to_swift(fn_arg, ret_arr_len, java_c_types_none_allowed, tuple_typ
101101
if is_ptr:
102102
res.pass_by_ref = True
103103
if res.is_native_primitive or res.passed_as_ptr:
104-
return TypeInfo(rust_obj=fn_arg.split(" ")[0], java_ty=res.java_ty + "[]", java_hu_ty=res.java_hu_ty + "[]",
105-
java_fn_ty_arg="[" + res.java_fn_ty_arg, c_ty=res.c_ty + "Array", passed_as_ptr=False,
104+
return TypeInfo(rust_obj=fn_arg.split(" ")[0], swift_type=res.swift_type + "[]",
105+
c_ty=res.c_ty + "Array", passed_as_ptr=False,
106106
is_ptr=is_ptr, is_const=is_const,
107107
var_name=res.var_name, arr_len="datalen", arr_access="data", subty=res,
108108
is_native_primitive=False)
109109
else:
110-
return TypeInfo(rust_obj=fn_arg.split(" ")[0], java_ty=res.java_ty + "[]", java_hu_ty=res.java_hu_ty + "[]",
111-
java_fn_ty_arg="[" + res.java_fn_ty_arg, c_ty=language_constants.ptr_arr,
110+
return TypeInfo(rust_obj=fn_arg.split(" ")[0], swift_type=res.swift_type + "[]",
111+
c_ty=language_constants.ptr_arr,
112112
passed_as_ptr=False, is_ptr=is_ptr, is_const=is_const,
113113
var_name=res.var_name, arr_len="datalen", arr_access="data", subty=res,
114114
is_native_primitive=False)
@@ -196,12 +196,12 @@ def map_types_to_swift(fn_arg, ret_arr_len, java_c_types_none_allowed, tuple_typ
196196
if idx != 0:
197197
swift_type = swift_type + ", "
198198
if ty_info.is_native_primitive:
199-
if ty_info.java_hu_ty == "int":
199+
if ty_info.swift_type == "int":
200200
swift_type = swift_type + "Integer" # Java concrete integer type is Integer, not Int
201201
else:
202-
swift_type = swift_type + ty_info.java_hu_ty.title() # If we're a primitive, capitalize the first letter
202+
swift_type = swift_type + ty_info.swift_type.title() # If we're a primitive, capitalize the first letter
203203
else:
204-
swift_type = swift_type + ty_info.java_hu_ty
204+
swift_type = swift_type + ty_info.swift_type
205205
swift_type = swift_type + ">"
206206
fn_ty_arg = "J"
207207
fn_arg = name_match
@@ -223,7 +223,7 @@ def map_types_to_swift(fn_arg, ret_arr_len, java_c_types_none_allowed, tuple_typ
223223
else:
224224
swift_type = swift_type + ty_info.java_hu_ty.title() # If we're a primitive, capitalize the first letter
225225
else:
226-
swift_type = swift_type + ty_info.java_hu_ty
226+
swift_type = swift_type + ty_info.swift_type
227227
swift_type = swift_type + ">"
228228
fn_ty_arg = "J"
229229
fn_arg = name_match

0 commit comments

Comments
 (0)