aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2017-06-18 17:35:27 +0100
committerGinger Bill <bill@gingerbill.org>2017-06-18 17:35:27 +0100
commit2957f007e34ed7e2704a40c9e7af9148aebcdf23 (patch)
tree790efa60482462327872ea9819dcd821816d245a /src/ir.cpp
parent04501c93fea4de6ecd085a80754d72f7d447972e (diff)
Fix #location for anonymous procedures
Diffstat (limited to 'src/ir.cpp')
-rw-r--r--src/ir.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index e73b0a288..7e4858c44 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -3677,7 +3677,7 @@ irValue *ir_build_builtin_proc(irProcedure *proc, AstNode *expr, TypeAndValue tv
Entity *e = entity_of_ident(proc->module->info, ident);
GB_ASSERT(e != NULL);
- if (e->parent_proc_decl != NULL) {
+ if (e->parent_proc_decl != NULL && e->parent_proc_decl->entity_count > 0) {
procedure = e->parent_proc_decl->entities[0]->token.string;
} else {
procedure = str_lit("");
@@ -4665,7 +4665,10 @@ irValue *ir_build_expr(irProcedure *proc, AstNode *expr) {
TypeTuple *pt = &type->params->Tuple;
if (arg_count < type->param_count) {
- String procedure = proc->entity->token.string;
+ String procedure = {};
+ if (proc->entity != NULL) {
+ procedure = proc->entity->token.string;
+ }
TokenPos pos = ast_node_token(ce->proc).pos;
isize end = type->param_count;