authorgravatar for alex_naskos@hotmail.comAlexandros Naskos <alex_naskos@hotmail.com> 2018-04-27 05:10:20+03:00
committergravatar for alex_naskos@hotmail.comAlexandros Naskos <alex_naskos@hotmail.com> 2018-04-27 05:10:20+03:00
logea2596280fc2c78f71b08921db3a4c9826eb93e0
treebe9a1fb60d8613f38d40d4077acd8531db5cdeb1
parent8f703f919f13e23b2c09f577a446aabb7799e27c

Added BoundFn TypeInfo generation.


2 files changed, 11 insertions(+), 7 deletions(-)

src/codegen.cpp+1-6
......@@ -6378,7 +6378,7 @@ static void define_builtin_compile_vars(CodeGen *g) {
63786378 " Fn: Fn,\n"
63796379 " Namespace: void,\n"
63806380 " Block: void,\n"
6381 " BoundFn: BoundFn,\n"
6381 " BoundFn: Fn,\n"
63826382 " ArgTuple: void,\n"
63836383 " Opaque: void,\n"
63846384 " Promise: Promise,\n"
......@@ -6494,11 +6494,6 @@ static void define_builtin_compile_vars(CodeGen *g) {
64946494 " args: []FnArg,\n"
64956495 " };\n"
64966496 "\n"
6497 " pub const BoundFn = struct {\n"
6498 " bound_type: type,\n"
6499 " fn_info: Fn,\n"
6500 " };\n"
6501 "\n"
65026497 " pub const Promise = struct {\n"
65036498 " child: type,\n"
65046499 " };\n"
src/ir.cpp+10-1
......@@ -16241,7 +16241,7 @@ static ConstExprValue *ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *t
1624116241 result->special = ConstValSpecialStatic;
1624216242 result->type = ir_type_info_get_type(ira, "Fn");
1624316243
16244 ConstExprValue *fields = create_const_vals(5);
16244 ConstExprValue *fields = create_const_vals(6);
1624516245 result->data.x_struct.fields = fields;
1624616246
1624716247 // @TODO Fix type = undefined with ?type
......@@ -16325,6 +16325,15 @@ static ConstExprValue *ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *t
1632516325 fn_arg_val->data.x_struct.parent.data.p_array.elem_index = fn_arg_index;
1632616326 }
1632716327
16328 break;
16329 }
16330 case TypeTableEntryIdBoundFn:
16331 {
16332 // @TODO figure out memory corruption error.
16333 TypeTableEntry *fn_type = type_entry->data.bound_fn.fn_type;
16334 assert(fn_type->id == TypeTableEntryIdFn);
16335 result = ir_make_type_info_value(ira, fn_type);
16336
1632816337 break;
1632916338 }
1633016339 }