mirror of
https://github.com/odin-lang/Odin.git
synced 2025-12-30 09:54:45 +00:00
#complete switch; Removal of dyncall
This commit is contained in:
@@ -375,6 +375,17 @@ void error(AstNode *node, char *fmt, ...) {
|
||||
va_end(va);
|
||||
}
|
||||
|
||||
void error_no_newline(AstNode *node, char *fmt, ...) {
|
||||
Token token = {};
|
||||
if (node != nullptr) {
|
||||
token = ast_node_token(node);
|
||||
}
|
||||
va_list va;
|
||||
va_start(va, fmt);
|
||||
error_no_newline_va(token, fmt, va);
|
||||
va_end(va);
|
||||
}
|
||||
|
||||
void warning(AstNode *node, char *fmt, ...) {
|
||||
va_list va;
|
||||
va_start(va, fmt);
|
||||
@@ -3700,6 +3711,20 @@ AstNode *parse_stmt(AstFile *f) {
|
||||
syntax_error(token, "#bounds_check and #no_bounds_check cannot be applied together");
|
||||
}
|
||||
return s;
|
||||
} else if (tag == "complete") {
|
||||
s = parse_stmt(f);
|
||||
switch (s->kind) {
|
||||
case AstNode_SwitchStmt:
|
||||
s->SwitchStmt.complete = true;
|
||||
break;
|
||||
case AstNode_TypeSwitchStmt:
|
||||
s->TypeSwitchStmt.complete = true;
|
||||
break;
|
||||
default:
|
||||
syntax_error(token, "#complete can only be applied to a switch statement");
|
||||
break;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
if (tag == "include") {
|
||||
|
||||
Reference in New Issue
Block a user