diff options
| author | gingerBill <bill@gingerbill.org> | 2018-02-17 19:40:33 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2018-02-17 19:40:33 +0000 |
| commit | a0f2357cb37621a735be98a0966b6b90a29f6f0b (patch) | |
| tree | c91ec34a915c5a07e482e5498233be5a8d9adaf9 /src/check_stmt.cpp | |
| parent | e86ac75e9c9923b876ece75f0e8bab57fe6ec1f3 (diff) | |
Minor fix to demo
Diffstat (limited to 'src/check_stmt.cpp')
| -rw-r--r-- | src/check_stmt.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp index a24d4477a..550ede70d 100644 --- a/src/check_stmt.cpp +++ b/src/check_stmt.cpp @@ -852,8 +852,6 @@ void check_type_switch_stmt(Checker *c, AstNode *node, u32 mod_flags) { check_label(c, ss->label); // TODO(bill): What should the label's "scope" be? - TypeSwitchKind switch_kind = TypeSwitch_Invalid; - if (ss->tag->kind != AstNode_AssignStmt) { error(ss->tag, "Expected an 'in' assignment for this type switch statement"); return; @@ -874,7 +872,8 @@ void check_type_switch_stmt(Checker *c, AstNode *node, u32 mod_flags) { check_expr(c, &x, rhs); check_assignment(c, &x, nullptr, str_lit("type switch expression")); - switch_kind = check_valid_type_switch_type(x.type); + + TypeSwitchKind switch_kind = check_valid_type_switch_type(x.type); if (switch_kind == TypeSwitch_Invalid) { gbString str = type_to_string(x.type); error(x.expr, "Invalid type for this type switch expression, got '%s'", str); @@ -911,7 +910,7 @@ void check_type_switch_stmt(Checker *c, AstNode *node, u32 mod_flags) { if (first_default != nullptr) { TokenPos pos = ast_node_token(first_default).pos; error(stmt, - "Multiple 'default' clauses\n" + "Multiple default clauses\n" "\tfirst at %.*s(%td:%td)", LIT(pos.file), pos.line, pos.column); } else { |