From b8697fb4ed34d0da0fa0888b57e6edcc37a0ce81 Mon Sep 17 00:00:00 2001 From: Ginger Bill Date: Thu, 13 Jul 2017 16:20:07 +0100 Subject: Change precedence order for types e.g. ^T(x) == ^(T(x)) --- src/check_stmt.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/check_stmt.cpp') 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) { -- cgit v1.2.3