authorgravatar for alex_naskos@hotmail.comAlexandros Naskos <alex_naskos@hotmail.com> 2018-04-28 18:38:38+03:00
committergravatar for alex_naskos@hotmail.comAlexandros Naskos <alex_naskos@hotmail.com> 2018-04-28 18:38:38+03:00
log9ba400673d798ea6f0842e4c207039c9faffb27e
tree09a0715aab1a2801747735a79e78c5d2828a230d
parent61b01805968939669a29f7189f4ce7fab46ab2da

Generating TypeInfo's now forces definitions to be resolved.


1 files changed, 29 insertions(+), 3 deletions(-)

src/ir.cpp+29-3
......@@ -15804,9 +15804,26 @@ static void ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, Scop
1580415804
1580515805 while ((curr_entry = decl_it.next()) != nullptr)
1580615806 {
15807 // Skip comptime blocks.
15807 // If the definition is unresolved, force it to be resolved again.
15808 if (curr_entry->value->resolution == TldResolutionUnresolved)
15809 {
15810 resolve_top_level_decl(ira->codegen, curr_entry->value, false, curr_entry->value->source_node);
15811 if (curr_entry->value->resolution != TldResolutionOk)
15812 {
15813 return;
15814 }
15815 }
15816
15817 // Skip comptime blocks and test functions.
1580815818 if (curr_entry->value->id != TldIdCompTime)
1580915819 {
15820 if (curr_entry->value->id == TldIdFn)
15821 {
15822 FnTableEntry *fn_entry = ((TldFn *)curr_entry->value)->fn_entry;
15823 if (fn_entry->is_test)
15824 continue;
15825 }
15826
1581015827 definition_count += 1;
1581115828 }
1581215829 }
......@@ -15825,9 +15842,15 @@ static void ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, Scop
1582515842 int definition_index = 0;
1582615843 while ((curr_entry = decl_it.next()) != nullptr)
1582715844 {
15828 // Skip comptime blocks
15845 // Skip comptime blocks and test functions.
1582915846 if (curr_entry->value->id == TldIdCompTime)
1583015847 continue;
15848 else if (curr_entry->value->id == TldIdFn)
15849 {
15850 FnTableEntry *fn_entry = ((TldFn *)curr_entry->value)->fn_entry;
15851 if (fn_entry->is_test)
15852 continue;
15853 }
1583115854
1583215855 ConstExprValue *definition_val = &definition_array->data.x_array.s_none.elements[definition_index];
1583315856
......@@ -15878,7 +15901,10 @@ static void ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, Scop
1587815901 {
1587915902 // 2: Data.Fn: Data.FnDef
1588015903 bigint_init_unsigned(&inner_fields[2].data.x_union.tag, 2);
15881 // @TODO Data.FnDef
15904
15905 FnTableEntry *fn_entry = ((TldFn *)curr_entry->value)->fn_entry;
15906 assert(!fn_entry->is_test);
15907
1588215908 inner_fields[2].data.x_union.payload = nullptr;
1588315909 break;
1588415910 }