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...@@ -15804,9 +15804,26 @@ static void ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, Scop
1580415804
15805 while ((curr_entry = decl_it.next()) != nullptr)15805 while ((curr_entry = decl_it.next()) != nullptr)
15806 {15806 {
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.
15808 if (curr_entry->value->id != TldIdCompTime)15818 if (curr_entry->value->id != TldIdCompTime)
15809 {15819 {
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
15810 definition_count += 1;15827 definition_count += 1;
15811 }15828 }
15812 }15829 }
...@@ -15825,9 +15842,15 @@ static void ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, Scop...@@ -15825,9 +15842,15 @@ static void ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, Scop
15825 int definition_index = 0;15842 int definition_index = 0;
15826 while ((curr_entry = decl_it.next()) != nullptr)15843 while ((curr_entry = decl_it.next()) != nullptr)
15827 {15844 {
15828 // Skip comptime blocks15845 // Skip comptime blocks and test functions.
15829 if (curr_entry->value->id == TldIdCompTime)15846 if (curr_entry->value->id == TldIdCompTime)
15830 continue;15847 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
15832 ConstExprValue *definition_val = &definition_array->data.x_array.s_none.elements[definition_index];15855 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...@@ -15878,7 +15901,10 @@ static void ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, Scop
15878 {15901 {
15879 // 2: Data.Fn: Data.FnDef15902 // 2: Data.Fn: Data.FnDef
15880 bigint_init_unsigned(&inner_fields[2].data.x_union.tag, 2);15903 bigint_init_unsigned(&inner_fields[2].data.x_union.tag, 2);
15881 // @TODO Data.FnDef15904
15905 FnTableEntry *fn_entry = ((TldFn *)curr_entry->value)->fn_entry;
15906 assert(!fn_entry->is_test);
15907
15882 inner_fields[2].data.x_union.payload = nullptr;15908 inner_fields[2].data.x_union.payload = nullptr;
15883 break;15909 break;
15884 }15910 }