diff options
| author | Ginger Bill <bill@gingerbill.org> | 2017-02-06 20:23:51 +0000 |
|---|---|---|
| committer | Ginger Bill <bill@gingerbill.org> | 2017-02-06 20:23:51 +0000 |
| commit | c126339090a57ab29a2c75d3ee79333cf3c88278 (patch) | |
| tree | dd20f3a4cfe045f36d000ac9f68a9c74f77d44bb /src/check_stmt.c | |
| parent | 9f2d9b596dab3f1409a92f218c3fc07a4839b295 (diff) | |
dynamic `map` insertion and lookup
Diffstat (limited to 'src/check_stmt.c')
| -rw-r--r-- | src/check_stmt.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/check_stmt.c b/src/check_stmt.c index 9b26adc5d..489b97fb4 100644 --- a/src/check_stmt.c +++ b/src/check_stmt.c @@ -256,13 +256,17 @@ Type *check_assignment_variable(Checker *c, Operand *op_a, AstNode *lhs) { e->flags |= EntityFlag_Used; } + Type *assignment_type = op_b.type; switch (op_b.mode) { case Addressing_Invalid: return NULL; case Addressing_Variable: break; - case Addressing_MapIndex: - break; + case Addressing_MapIndex: { + Type *t = base_type(assignment_type); GB_ASSERT(is_type_tuple(t)); + t = t->Tuple.variables[0]->type; + assignment_type = t; + } break; default: { if (op_b.expr->kind == AstNode_SelectorExpr) { // NOTE(bill): Extra error checks @@ -287,7 +291,7 @@ Type *check_assignment_variable(Checker *c, Operand *op_a, AstNode *lhs) { } break; } - check_assignment(c, op_a, op_b.type, str_lit("assignment")); + check_assignment(c, op_a, assignment_type, str_lit("assignment")); if (op_a->mode == Addressing_Invalid) { return NULL; } |