mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-07 16:18:52 +00:00
Minor fix to demo
This commit is contained in:
+1
-1
@@ -730,6 +730,7 @@ explicit_procedure_overloading :: proc() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
complete_switch :: proc() {
|
complete_switch :: proc() {
|
||||||
|
fmt.println("# complete_switch");
|
||||||
{ // enum
|
{ // enum
|
||||||
Foo :: enum #export {
|
Foo :: enum #export {
|
||||||
A,
|
A,
|
||||||
@@ -741,7 +742,6 @@ complete_switch :: proc() {
|
|||||||
b := Foo.B;
|
b := Foo.B;
|
||||||
f := Foo.A;
|
f := Foo.A;
|
||||||
#complete switch f {
|
#complete switch f {
|
||||||
// case A...C: fmt.println("A...C");
|
|
||||||
case A: fmt.println("A");
|
case A: fmt.println("A");
|
||||||
case B: fmt.println("B");
|
case B: fmt.println("B");
|
||||||
case C: fmt.println("C");
|
case C: fmt.println("C");
|
||||||
|
|||||||
+3
-4
@@ -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?
|
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) {
|
if (ss->tag->kind != AstNode_AssignStmt) {
|
||||||
error(ss->tag, "Expected an 'in' assignment for this type switch statement");
|
error(ss->tag, "Expected an 'in' assignment for this type switch statement");
|
||||||
return;
|
return;
|
||||||
@@ -874,7 +872,8 @@ void check_type_switch_stmt(Checker *c, AstNode *node, u32 mod_flags) {
|
|||||||
|
|
||||||
check_expr(c, &x, rhs);
|
check_expr(c, &x, rhs);
|
||||||
check_assignment(c, &x, nullptr, str_lit("type switch expression"));
|
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) {
|
if (switch_kind == TypeSwitch_Invalid) {
|
||||||
gbString str = type_to_string(x.type);
|
gbString str = type_to_string(x.type);
|
||||||
error(x.expr, "Invalid type for this type switch expression, got '%s'", str);
|
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) {
|
if (first_default != nullptr) {
|
||||||
TokenPos pos = ast_node_token(first_default).pos;
|
TokenPos pos = ast_node_token(first_default).pos;
|
||||||
error(stmt,
|
error(stmt,
|
||||||
"Multiple 'default' clauses\n"
|
"Multiple default clauses\n"
|
||||||
"\tfirst at %.*s(%td:%td)",
|
"\tfirst at %.*s(%td:%td)",
|
||||||
LIT(pos.file), pos.line, pos.column);
|
LIT(pos.file), pos.line, pos.column);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user