aboutsummaryrefslogtreecommitdiff
path: root/src/checker/expr.cpp
diff options
context:
space:
mode:
authorgingerBill <ginger.bill.22@gmail.com>2016-08-23 00:03:53 +0100
committergingerBill <ginger.bill.22@gmail.com>2016-08-23 00:03:53 +0100
commitaaecb18c8f37a7f7feb3400178633819859b642f (patch)
tree57667583efc5199150bd1b4d7fcbc93b97a1575d /src/checker/expr.cpp
parent81c592b5e92411e4b64744a152bd445bb6154433 (diff)
Fix procedure's scope
Diffstat (limited to 'src/checker/expr.cpp')
-rw-r--r--src/checker/expr.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/checker/expr.cpp b/src/checker/expr.cpp
index 128d9e6e0..bd317c08d 100644
--- a/src/checker/expr.cpp
+++ b/src/checker/expr.cpp
@@ -202,7 +202,7 @@ void check_identifier(Checker *c, Operand *o, AstNode *n, Type *named_type) {
o->mode = Addressing_Invalid;
o->expr = n;
ast_node(i, Ident, n);
- Entity *e = scope_lookup_entity(c->context.scope, i->token.string);
+ Entity *e = scope_lookup_entity(c, c->context.scope, i->token.string);
if (e == NULL) {
error(&c->error_collector, i->token,
"Undeclared type or identifier `%.*s`", LIT(i->token.string));
@@ -1959,14 +1959,9 @@ ExpressionKind check__expr_base(Checker *c, Operand *o, AstNode *node, Type *typ
case_end;
case_ast_node(pl, ProcLit, node);
- auto curr_context = c->context;
- c->context.scope = c->global_scope;
check_open_scope(c, pl->type);
c->context.decl = make_declaration_info(c->allocator, c->context.scope);
- defer ({
- check_close_scope(c);
- c->context = curr_context;
- });
+ defer (check_close_scope(c));
Type *proc_type = check_type(c, pl->type);
if (proc_type != NULL) {
check_proc_body(c, empty_token, c->context.decl, proc_type, pl->body);