aboutsummaryrefslogtreecommitdiff
path: root/src/check_stmt.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2018-12-24 16:11:24 +0000
committergingerBill <bill@gingerbill.org>2018-12-24 16:11:24 +0000
commit956dd26aa0c031709f006d3fec0ef0c5add87e1b (patch)
treedf76335e8920d2cdcbfd72bedd4ddb6e076ecf1d /src/check_stmt.cpp
parentb504d6e12ab70de583f70955c8ba6150b23ddc56 (diff)
Fix race condition; Change `for in` addressing mode
Diffstat (limited to 'src/check_stmt.cpp')
-rw-r--r--src/check_stmt.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp
index 2430eee9f..811f59907 100644
--- a/src/check_stmt.cpp
+++ b/src/check_stmt.cpp
@@ -1452,15 +1452,15 @@ void check_stmt_internal(CheckerContext *ctx, Ast *node, u32 flags) {
}
skip_expr:; // NOTE(zhiayang): again, declaring a variable immediately after a label... weird.
- Ast *lhs[2] = {rs->val0, rs->val1};
- Type * rhs[2] = {val0, val1};
+ Ast * lhs[2] = {rs->val0, rs->val1};
+ Type *rhs[2] = {val0, val1};
for (isize i = 0; i < 2; i++) {
if (lhs[i] == nullptr) {
continue;
}
- Ast *name = lhs[i];
- Type * type = rhs[i];
+ Ast * name = lhs[i];
+ Type *type = rhs[i];
Entity *entity = nullptr;
if (name->kind == Ast_Ident) {
@@ -1472,8 +1472,9 @@ void check_stmt_internal(CheckerContext *ctx, Ast *node, u32 flags) {
found = scope_lookup_current(ctx->scope, str);
}
if (found == nullptr) {
- bool is_immutable = true;
+ bool is_immutable = false;
entity = alloc_entity_variable(ctx->scope, token, type, is_immutable, EntityState_Resolved);
+ entity->flags |= EntityFlag_Value;
add_entity_definition(&ctx->checker->info, name, entity);
} else {
TokenPos pos = found->token.pos;