mirror of
https://github.com/odin-lang/Odin.git
synced 2026-05-04 20:14:44 +00:00
Minor fix to demo
This commit is contained in:
@@ -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");
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user