aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2020-12-05 20:47:50 +0000
committergingerBill <bill@gingerbill.org>2020-12-05 20:47:50 +0000
commit069c6cac3f42ec7a2428062b0e8c481b755534ad (patch)
treeb2093c40b8731b4ecc0fa0038c42d4f9843aa48f /src/ir.cpp
parent1a8ea6113a16e1a762106ba97442c1e991041841 (diff)
Add package name and source code location to `Type_Info_Named`
Diffstat (limited to 'src/ir.cpp')
-rw-r--r--src/ir.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index 1e364c7ba..e46eb27fb 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -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;
}