| ... | @@ -15920,7 +15920,7 @@ static void ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, Scop | ... | @@ -15920,7 +15920,7 @@ static void ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, Scop |
| 15920 | fn_def_val->data.x_struct.parent.data.p_union.union_val = &inner_fields[2]; | 15920 | fn_def_val->data.x_struct.parent.data.p_union.union_val = &inner_fields[2]; |
| 15921 | | 15921 | |
| 15922 | // @TODO Add fields | 15922 | // @TODO Add fields |
| 15923 | ConstExprValue *fn_def_fields = create_const_vals(3); | 15923 | ConstExprValue *fn_def_fields = create_const_vals(7); |
| 15924 | fn_def_val->data.x_struct.fields = fn_def_fields; | 15924 | fn_def_val->data.x_struct.fields = fn_def_fields; |
| 15925 | | 15925 | |
| 15926 | // fn_type: type | 15926 | // fn_type: type |
| ... | @@ -15938,6 +15938,40 @@ static void ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, Scop | ... | @@ -15938,6 +15938,40 @@ static void ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, Scop |
| 15938 | fn_def_fields[2].special = ConstValSpecialStatic; | 15938 | fn_def_fields[2].special = ConstValSpecialStatic; |
| 15939 | fn_def_fields[2].type = ir_type_info_get_type(ira, "CallingConvention"); | 15939 | fn_def_fields[2].type = ir_type_info_get_type(ira, "CallingConvention"); |
| 15940 | bigint_init_unsigned(&fn_def_fields[2].data.x_enum_tag, fn_node->cc); | 15940 | bigint_init_unsigned(&fn_def_fields[2].data.x_enum_tag, fn_node->cc); |
| | 15941 | // is_var_args: bool |
| | 15942 | ensure_field_index(fn_def_val->type, "is_var_args", 3); |
| | 15943 | fn_def_fields[3].special = ConstValSpecialStatic; |
| | 15944 | fn_def_fields[3].type = ira->codegen->builtin_types.entry_bool; |
| | 15945 | fn_def_fields[3].data.x_bool = fn_node->is_var_args; |
| | 15946 | // is_extern: bool |
| | 15947 | ensure_field_index(fn_def_val->type, "is_extern", 4); |
| | 15948 | fn_def_fields[4].special = ConstValSpecialStatic; |
| | 15949 | fn_def_fields[4].type = ira->codegen->builtin_types.entry_bool; |
| | 15950 | fn_def_fields[4].data.x_bool = fn_node->is_extern; |
| | 15951 | // is_export: bool |
| | 15952 | ensure_field_index(fn_def_val->type, "is_export", 5); |
| | 15953 | fn_def_fields[5].special = ConstValSpecialStatic; |
| | 15954 | fn_def_fields[5].type = ira->codegen->builtin_types.entry_bool; |
| | 15955 | fn_def_fields[5].data.x_bool = fn_node->is_export; |
| | 15956 | // lib_name: ?[]const u8 |
| | 15957 | ensure_field_index(fn_def_val->type, "lib_name", 6); |
| | 15958 | fn_def_fields[6].special = ConstValSpecialStatic; |
| | 15959 | fn_def_fields[6].type = get_maybe_type(ira->codegen, |
| | 15960 | get_slice_type(ira->codegen, get_pointer_to_type(ira->codegen, |
| | 15961 | ira->codegen->builtin_types.entry_u8, true))); |
| | 15962 | |
| | 15963 | |
| | 15964 | if (fn_node->is_extern && buf_len(fn_node->lib_name) > 0) |
| | 15965 | { |
| | 15966 | fn_def_fields[6].data.x_maybe = create_const_vals(1); |
| | 15967 | // @TODO Figure out if lib_name is always non-null for extern fns. |
| | 15968 | ConstExprValue *lib_name = create_const_str_lit(ira->codegen, fn_node->lib_name); |
| | 15969 | init_const_slice(ira->codegen, fn_def_fields[6].data.x_maybe, lib_name, 0, buf_len(fn_node->lib_name), true); |
| | 15970 | } |
| | 15971 | else |
| | 15972 | { |
| | 15973 | fn_def_fields[6].data.x_maybe = nullptr; |
| | 15974 | } |
| 15941 | | 15975 | |
| 15942 | inner_fields[2].data.x_union.payload = fn_def_val; | 15976 | inner_fields[2].data.x_union.payload = fn_def_val; |
| 15943 | break; | 15977 | break; |