authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2016-11-26 21:16:36-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2016-11-26 21:16:36-05:00
loga3db60b5d726004cbb5d7235893a3e148b493096
tree04378ee8fc0007881370fbf3ce3e80984e2acbdf
parent84f7805029e6a272f51bfa106cc40081a8581823

IR: fix parsing while loop


1 files changed, 3 insertions(+), 0 deletions(-)

src/parser.cpp+3
......@@ -76,11 +76,13 @@ static AstNode *ast_create_node_no_line_info(ParseContext *pc, NodeType type) {
7676}
7777
7878static void ast_update_node_line_info(AstNode *node, Token *first_token) {
79 assert(first_token);
7980 node->line = first_token->start_line;
8081 node->column = first_token->start_column;
8182}
8283
8384static AstNode *ast_create_node(ParseContext *pc, NodeType type, Token *first_token) {
85 assert(first_token);
8486 AstNode *node = ast_create_node_no_line_info(pc, type);
8587 ast_update_node_line_info(node, first_token);
8688 return node;
......@@ -1541,6 +1543,7 @@ static AstNode *ast_parse_while_expr(ParseContext *pc, size_t *token_index, bool
15411543 return nullptr;
15421544 }
15431545 } else if (first_token->id == TokenIdKeywordWhile) {
1546 while_token = first_token;
15441547 is_inline = false;
15451548 *token_index += 1;
15461549 } else if (mandatory) {