mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-08 00:28:49 +00:00
Fix indentations
Fix Objective-C wrapper procs not forwarding return value
This commit is contained in:
+16
-2
@@ -1656,7 +1656,15 @@ gb_internal void lb_finalize_objc_names(lbGenerator *gen, lbProcedure *p) {
|
||||
}
|
||||
|
||||
Type *wrapper_args_tuple = alloc_type_tuple_from_field_types(wrapper_args.data, wrapper_args.count, false, true);
|
||||
Type *wrapper_proc_type = alloc_type_proc(nullptr, wrapper_args_tuple, (isize)wrapper_args_tuple->Tuple.variables.count, nullptr, 0, false, ProcCC_CDecl);
|
||||
Type *wrapper_results_tuple = nullptr;
|
||||
|
||||
if (method_type->Proc.result_count > 0) {
|
||||
GB_ASSERT(method_type->Proc.result_count == 1);
|
||||
wrapper_results_tuple = alloc_type_tuple_from_field_types(&method_type->Proc.results->Tuple.variables[0]->type, 1, false, true);
|
||||
}
|
||||
|
||||
Type *wrapper_proc_type = alloc_type_proc(nullptr, wrapper_args_tuple, wrapper_args_tuple->Tuple.variables.count,
|
||||
wrapper_results_tuple, method_type->Proc.result_count, false, ProcCC_CDecl);
|
||||
|
||||
lbProcedure *wrapper_proc = lb_create_dummy_procedure(m, proc_name, wrapper_proc_type);
|
||||
lb_add_attribute_to_proc(wrapper_proc->module, wrapper_proc->value, "nounwind");
|
||||
@@ -1709,7 +1717,13 @@ gb_internal void lb_finalize_objc_names(lbGenerator *gen, lbProcedure *p) {
|
||||
lbValue method_proc_value = lb_find_procedure_value_from_entity(m, md.proc_entity);
|
||||
|
||||
// Call real procedure for method from here, passing the parameters expected, if any.
|
||||
lb_emit_call(wrapper_proc, method_proc_value, method_call_args);
|
||||
lbValue return_value = lb_emit_call(wrapper_proc, method_proc_value, method_call_args);
|
||||
|
||||
if (wrapper_results_tuple != nullptr) {
|
||||
auto &result_var = method_type->Proc.results->Tuple.variables[0];
|
||||
return_value = lb_emit_conv(wrapper_proc, return_value, result_var->type);
|
||||
lb_build_return_stmt_internal(wrapper_proc, return_value, result_var->token.pos);
|
||||
}
|
||||
}
|
||||
lb_end_procedure_body(wrapper_proc);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user