fix noalias codegen

also make some parsing error messages better
This commit is contained in:
Andrew Kelley
2016-01-13 22:18:10 -07:00
parent 95a7f3553d
commit d121ed961a
6 changed files with 104 additions and 83 deletions

View File

@@ -913,9 +913,13 @@ static AstNode *ast_parse_block_expr(ParseContext *pc, int *token_index, bool ma
static AstNode *ast_parse_unwrap_maybe_expr(ParseContext *pc, int *token_index, bool mandatory);
static void ast_expect_token(ParseContext *pc, Token *token, TokenId token_id) {
if (token->id != token_id) {
ast_invalid_token_error(pc, token);
if (token->id == token_id) {
return;
}
Buf token_value = BUF_INIT;
ast_buf_from_token(pc, token, &token_value);
ast_error(pc, token, "expected token '%s', found '%s'", token_name(token_id), token_name(token->id));
}
static Token *ast_eat_token(ParseContext *pc, int *token_index, TokenId token_id) {