mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-07 16:18:52 +00:00
Fix issue #195
This commit is contained in:
+2
-6
@@ -1358,6 +1358,7 @@ void expect_semicolon(AstFile *f, AstNode *s) {
|
|||||||
switch (f->curr_token.kind) {
|
switch (f->curr_token.kind) {
|
||||||
case Token_CloseBrace:
|
case Token_CloseBrace:
|
||||||
case Token_CloseParen:
|
case Token_CloseParen:
|
||||||
|
case Token_else:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3175,7 +3176,7 @@ AstNode *parse_when_stmt(AstFile *f) {
|
|||||||
break;
|
break;
|
||||||
case Token_do: {
|
case Token_do: {
|
||||||
Token arrow = expect_token(f, Token_do);
|
Token arrow = expect_token(f, Token_do);
|
||||||
body = convert_stmt_to_body(f, parse_stmt(f));
|
else_stmt = convert_stmt_to_body(f, parse_stmt(f));
|
||||||
} break;
|
} break;
|
||||||
default:
|
default:
|
||||||
syntax_error(f->curr_token, "Expected when statement block statement");
|
syntax_error(f->curr_token, "Expected when statement block statement");
|
||||||
@@ -3184,11 +3185,6 @@ AstNode *parse_when_stmt(AstFile *f) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (f->curr_proc == nullptr && f->when_level > 1) {
|
|
||||||
// syntax_error(token, "Nested when statements are not currently supported at the file scope");
|
|
||||||
// return ast_bad_stmt(f, token, f->curr_token);
|
|
||||||
// }
|
|
||||||
|
|
||||||
return ast_when_stmt(f, token, cond, body, else_stmt);
|
return ast_when_stmt(f, token, cond, body, else_stmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user