aboutsummaryrefslogtreecommitdiff
path: root/src/checker/stmt.cpp
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2016-10-30 13:20:45 +0000
committerGinger Bill <bill@gingerbill.org>2016-10-30 13:20:45 +0000
commit3ec67853e1359015f516aac346760b299d261015 (patch)
treef3d87cd63e14fe1704b97431816f05dcec519fbf /src/checker/stmt.cpp
parent09f39ae2ccea78ecd37facc5431c51e4c9666630 (diff)
Minor `Entity` refactor
Diffstat (limited to 'src/checker/stmt.cpp')
-rw-r--r--src/checker/stmt.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/checker/stmt.cpp b/src/checker/stmt.cpp
index a4647fc29..54ae39ba3 100644
--- a/src/checker/stmt.cpp
+++ b/src/checker/stmt.cpp
@@ -252,14 +252,16 @@ Type *check_assignment_variable(Checker *c, Operand *op_a, AstNode *lhs) {
ast_node(i, Ident, node);
e = scope_lookup_entity(c->context.scope, i->string);
if (e != NULL && e->kind == Entity_Variable) {
- used = e->Variable.used; // TODO(bill): Make backup just in case
+ used = (e->flags & EntityFlag_Used) != 0; // TODO(bill): Make backup just in case
}
}
Operand op_b = {Addressing_Invalid};
check_expr(c, &op_b, lhs);
- if (e) e->Variable.used = used;
+ if (e) {
+ e->flags |= EntityFlag_Used*used;
+ }
if (op_b.mode == Addressing_Invalid ||
op_b.type == t_invalid) {
@@ -829,7 +831,7 @@ void check_stmt(Checker *c, AstNode *node, u32 flags) {
// NOTE(bill): Dummy type
Type *tag_ptr_type = make_type_pointer(c->allocator, tag_type);
Entity *tag_var = make_entity_variable(c->allocator, c->context.scope, ms->var->Ident, tag_ptr_type);
- tag_var->Variable.used = true;
+ tag_var->flags |= EntityFlag_Used;
add_entity(c, c->context.scope, ms->var, tag_var);
add_entity_use(c, ms->var, tag_var);
}