mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-17 08:21:25 -07:00
Fix _preload.odin; Add for in without parameters; Change sync.Mutex for windows
This commit is contained in:
+18
-1
@@ -3992,7 +3992,25 @@ AstNode *parse_for_stmt(AstFile *f) {
|
||||
if (f->curr_token.kind != Token_OpenBrace &&
|
||||
f->curr_token.kind != Token_do) {
|
||||
isize prev_level = f->expr_level;
|
||||
defer (f->expr_level = prev_level);
|
||||
f->expr_level = -1;
|
||||
|
||||
if (f->curr_token.kind == Token_in) {
|
||||
Token in_token = expect_token(f, Token_in);
|
||||
AstNode *rhs = nullptr;
|
||||
bool prev_allow_range = f->allow_range;
|
||||
f->allow_range = true;
|
||||
rhs = parse_expr(f, false);
|
||||
f->allow_range = prev_allow_range;
|
||||
|
||||
if (allow_token(f, Token_do)) {
|
||||
body = convert_stmt_to_body(f, parse_stmt(f));
|
||||
} else {
|
||||
body = parse_block_stmt(f, false);
|
||||
}
|
||||
return ast_range_stmt(f, token, nullptr, nullptr, in_token, rhs, body);
|
||||
}
|
||||
|
||||
if (f->curr_token.kind != Token_Semicolon) {
|
||||
cond = parse_simple_stmt(f, StmtAllowFlag_In);
|
||||
if (cond->kind == AstNode_AssignStmt && cond->AssignStmt.op.kind == Token_in) {
|
||||
@@ -4014,7 +4032,6 @@ AstNode *parse_for_stmt(AstFile *f) {
|
||||
}
|
||||
}
|
||||
|
||||
f->expr_level = prev_level;
|
||||
}
|
||||
|
||||
if (allow_token(f, Token_do)) {
|
||||
|
||||
+3
-3
@@ -94,14 +94,14 @@ TOKEN_KIND(Token__KeywordBegin, "_KeywordBegin"), \
|
||||
TOKEN_KIND(Token_if, "if"), \
|
||||
TOKEN_KIND(Token_else, "else"), \
|
||||
TOKEN_KIND(Token_for, "for"), \
|
||||
TOKEN_KIND(Token_in, "in"), \
|
||||
TOKEN_KIND(Token_match, "match"), \
|
||||
TOKEN_KIND(Token_in, "in"), \
|
||||
TOKEN_KIND(Token_do, "do"), \
|
||||
TOKEN_KIND(Token_case, "case"), \
|
||||
TOKEN_KIND(Token_break, "break"), \
|
||||
TOKEN_KIND(Token_continue, "continue"), \
|
||||
TOKEN_KIND(Token_fallthrough, "fallthrough"), \
|
||||
TOKEN_KIND(Token_defer, "defer"), \
|
||||
TOKEN_KIND(Token_do, "do"), \
|
||||
TOKEN_KIND(Token_return, "return"), \
|
||||
TOKEN_KIND(Token_proc, "proc"), \
|
||||
TOKEN_KIND(Token_macro, "macro"), \
|
||||
@@ -111,9 +111,9 @@ TOKEN_KIND(Token__KeywordBegin, "_KeywordBegin"), \
|
||||
TOKEN_KIND(Token_enum, "enum"), \
|
||||
TOKEN_KIND(Token_bit_field, "bit_field"), \
|
||||
TOKEN_KIND(Token_vector, "vector"), \
|
||||
TOKEN_KIND(Token_map, "map"), \
|
||||
TOKEN_KIND(Token_static, "static"), \
|
||||
TOKEN_KIND(Token_dynamic, "dynamic"), \
|
||||
TOKEN_KIND(Token_map, "map"), \
|
||||
TOKEN_KIND(Token_using, "using"), \
|
||||
TOKEN_KIND(Token_context, "context"), \
|
||||
TOKEN_KIND(Token_push_context, "push_context"), \
|
||||
|
||||
Reference in New Issue
Block a user