diff options
| author | Ginger Bill <bill@gingerbill.org> | 2017-07-13 16:20:07 +0100 |
|---|---|---|
| committer | Ginger Bill <bill@gingerbill.org> | 2017-07-13 16:20:07 +0100 |
| commit | b8697fb4ed34d0da0fa0888b57e6edcc37a0ce81 (patch) | |
| tree | fe3dd4008b6878b1b0b5015131e9a35129845123 /src/check_stmt.cpp | |
| parent | 03570275c1cfd14014d81bcdf085c320c1902c40 (diff) | |
Change precedence order for types e.g. ^T(x) == ^(T(x))
Diffstat (limited to 'src/check_stmt.cpp')
| -rw-r--r-- | src/check_stmt.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp index 4d07ce1cf..6bf873bd3 100644 --- a/src/check_stmt.cpp +++ b/src/check_stmt.cpp @@ -186,8 +186,7 @@ Type *check_assignment_variable(Checker *c, Operand *rhs, AstNode *lhs_node) { AstNode *node = unparen_expr(lhs_node); // NOTE(bill): Ignore assignments to `_` - if (node->kind == AstNode_Ident && - node->Ident.token.string == "_") { + if (is_blank_ident(node)) { add_entity_definition(&c->info, node, nullptr); check_assignment(c, rhs, nullptr, str_lit("assignment to `_` identifier")); if (rhs->mode == Addressing_Invalid) { @@ -429,7 +428,7 @@ void check_label(Checker *c, AstNode *label) { return; } String name = l->name->Ident.token.string; - if (name == "_") { + if (is_blank_ident(name)) { error(l->name, "A label's name cannot be a blank identifier"); return; } @@ -884,7 +883,7 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) { for (isize i = 0; i < result_count; i++) { if (!visited[i]) { Entity *e = pt->results->Tuple.variables[i]; - if (e->token.string == "_") { + if (is_blank_ident(e->token)) { continue; } GB_ASSERT(e->kind == Entity_Variable); @@ -1133,7 +1132,7 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) { String str = token.string; Entity *found = nullptr; - if (str != "_") { + if (!is_blank_ident(str)) { found = current_scope_lookup_entity(c->context.scope, str); } if (found == nullptr) { @@ -1686,7 +1685,7 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) { String str = token.string; Entity *found = nullptr; // NOTE(bill): Ignore assignments to `_` - if (str != "_") { + if (!is_blank_ident(str)) { found = current_scope_lookup_entity(c->context.scope, str); } if (found == nullptr) { |