aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2016-11-26 21:16:36 -0500
committerAndrew Kelley <superjoe30@gmail.com>2016-11-26 21:16:36 -0500
commita3db60b5d726004cbb5d7235893a3e148b493096 (patch)
tree04378ee8fc0007881370fbf3ce3e80984e2acbdf /src
parent84f7805029e6a272f51bfa106cc40081a8581823 (diff)
downloadzig-a3db60b5d726004cbb5d7235893a3e148b493096.tar.gz
zig-a3db60b5d726004cbb5d7235893a3e148b493096.zip
IR: fix parsing while loop
Diffstat (limited to 'src')
-rw-r--r--src/parser.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/parser.cpp b/src/parser.cpp
index c316dada4c..00f8b430f2 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -76,11 +76,13 @@ static AstNode *ast_create_node_no_line_info(ParseContext *pc, NodeType type) {
}
static void ast_update_node_line_info(AstNode *node, Token *first_token) {
+ assert(first_token);
node->line = first_token->start_line;
node->column = first_token->start_column;
}
static AstNode *ast_create_node(ParseContext *pc, NodeType type, Token *first_token) {
+ assert(first_token);
AstNode *node = ast_create_node_no_line_info(pc, type);
ast_update_node_line_info(node, first_token);
return node;
@@ -1541,6 +1543,7 @@ static AstNode *ast_parse_while_expr(ParseContext *pc, size_t *token_index, bool
return nullptr;
}
} else if (first_token->id == TokenIdKeywordWhile) {
+ while_token = first_token;
is_inline = false;
*token_index += 1;
} else if (mandatory) {