Minor fix to demo

This commit is contained in:
gingerBill
2018-02-17 19:40:33 +00:00
parent e86ac75e9c
commit a0f2357cb3
2 changed files with 4 additions and 5 deletions

View File

@@ -730,6 +730,7 @@ explicit_procedure_overloading :: proc() {
}
complete_switch :: proc() {
fmt.println("# complete_switch");
{ // enum
Foo :: enum #export {
A,
@@ -741,7 +742,6 @@ complete_switch :: proc() {
b := Foo.B;
f := Foo.A;
#complete switch f {
// case A...C: fmt.println("A...C");
case A: fmt.println("A");
case B: fmt.println("B");
case C: fmt.println("C");

View File

@@ -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 {