Add package name and source code location to Type_Info_Named

This commit is contained in:
gingerBill
2020-12-05 20:47:50 +00:00
parent 1a8ea6113a
commit 069c6cac3f
3 changed files with 43 additions and 2 deletions
+15
View File
@@ -12172,6 +12172,21 @@ void ir_setup_type_info_data(irProcedure *proc) { // NOTE(bill): Setup type_info
ir_emit_store(proc, ir_emit_struct_ep(proc, tag, 0), name);
ir_emit_store(proc, ir_emit_struct_ep(proc, tag, 1), gtip);
if (t->Named.type_name->pkg) {
irValue *name = ir_const_string(proc->module, t->Named.type_name->pkg->name);
ir_emit_store(proc, ir_emit_struct_ep(proc, tag, 2), name);
}
String proc_name = {};
if (t->Named.type_name->parent_proc_decl) {
DeclInfo *decl = t->Named.type_name->parent_proc_decl;
if (decl->entity && decl->entity->kind == Entity_Procedure) {
proc_name = decl->entity->token.string;
}
}
irValue *loc = ir_emit_source_code_location(proc, proc_name, t->Named.type_name->token.pos);
ir_emit_store(proc, ir_emit_struct_ep(proc, tag, 3), loc);
break;
}