Added BoundFn TypeInfo generation.

master
Alexandros Naskos 2018-04-27 05:10:20 +03:00
parent 8f703f919f
commit ea2596280f
2 changed files with 11 additions and 7 deletions

View File

@ -6378,7 +6378,7 @@ static void define_builtin_compile_vars(CodeGen *g) {
" Fn: Fn,\n" " Fn: Fn,\n"
" Namespace: void,\n" " Namespace: void,\n"
" Block: void,\n" " Block: void,\n"
" BoundFn: BoundFn,\n" " BoundFn: Fn,\n"
" ArgTuple: void,\n" " ArgTuple: void,\n"
" Opaque: void,\n" " Opaque: void,\n"
" Promise: Promise,\n" " Promise: Promise,\n"
@ -6494,11 +6494,6 @@ static void define_builtin_compile_vars(CodeGen *g) {
" args: []FnArg,\n" " args: []FnArg,\n"
" };\n" " };\n"
"\n" "\n"
" pub const BoundFn = struct {\n"
" bound_type: type,\n"
" fn_info: Fn,\n"
" };\n"
"\n"
" pub const Promise = struct {\n" " pub const Promise = struct {\n"
" child: type,\n" " child: type,\n"
" };\n" " };\n"

View File

@ -16241,7 +16241,7 @@ static ConstExprValue *ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *t
result->special = ConstValSpecialStatic; result->special = ConstValSpecialStatic;
result->type = ir_type_info_get_type(ira, "Fn"); result->type = ir_type_info_get_type(ira, "Fn");
ConstExprValue *fields = create_const_vals(5); ConstExprValue *fields = create_const_vals(6);
result->data.x_struct.fields = fields; result->data.x_struct.fields = fields;
// @TODO Fix type = undefined with ?type // @TODO Fix type = undefined with ?type
@ -16325,6 +16325,15 @@ static ConstExprValue *ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *t
fn_arg_val->data.x_struct.parent.data.p_array.elem_index = fn_arg_index; fn_arg_val->data.x_struct.parent.data.p_array.elem_index = fn_arg_index;
} }
break;
}
case TypeTableEntryIdBoundFn:
{
// @TODO figure out memory corruption error.
TypeTableEntry *fn_type = type_entry->data.bound_fn.fn_type;
assert(fn_type->id == TypeTableEntryIdFn);
result = ir_make_type_info_value(ira, fn_type);
break; break;
} }
} }