mirror of
https://github.com/odin-lang/Odin.git
synced 2025-12-31 18:32:12 +00:00
Improve error handling for invalid syntax doing [*]T
This commit is contained in:
@@ -2454,9 +2454,15 @@ gb_internal i64 check_array_count(CheckerContext *ctx, Operand *o, Ast *e) {
|
||||
if (e == nullptr) {
|
||||
return 0;
|
||||
}
|
||||
if (e->kind == Ast_UnaryExpr &&
|
||||
e->UnaryExpr.op.kind == Token_Question) {
|
||||
return -1;
|
||||
if (e->kind == Ast_UnaryExpr) {
|
||||
Token op = e->UnaryExpr.op;
|
||||
if (op.kind == Token_Question) {
|
||||
return -1;
|
||||
}
|
||||
if (e->UnaryExpr.expr == nullptr) {
|
||||
error(op, "Invalid array count '[%.*s]'", LIT(op.string));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
check_expr_or_type(ctx, o, e);
|
||||
|
||||
Reference in New Issue
Block a user