Give a better error message when the user uses context as if it was an identifier in a field list.

This commit is contained in:
gingerBill
2024-02-22 18:52:17 +00:00
parent fd987b29ff
commit 980947b355

View File

@@ -4001,6 +4001,10 @@ gb_internal Array<Ast *> convert_to_ident_list(AstFile *f, Array<AstAndFlags> li
case Ast_Ident:
case Ast_BadExpr:
break;
case Ast_Implicit:
syntax_error(ident, "Expected an identifier, '%.*s' which is a keyword", LIT(ident->Implicit.string));
ident = ast_ident(f, blank_token);
break;
case Ast_PolyType:
if (allow_poly_names) {
@@ -4014,8 +4018,9 @@ gb_internal Array<Ast *> convert_to_ident_list(AstFile *f, Array<AstAndFlags> li
}
/*fallthrough*/
default:
syntax_error(ident, "Expected an identifier");
syntax_error(ident, "Expected an identifier, %d", ident->kind);
ident = ast_ident(f, blank_token);
break;
}