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) {...@@ -76,11 +76,13 @@ static AstNode *ast_create_node_no_line_info(ParseContext *pc, NodeType type) {
76}76}
7777
78static void ast_update_node_line_info(AstNode *node, Token *first_token) {78static void ast_update_node_line_info(AstNode *node, Token *first_token) {
79 assert(first_token);
79 node->line = first_token->start_line;80 node->line = first_token->start_line;
80 node->column = first_token->start_column;81 node->column = first_token->start_column;
81}82}
8283
83static AstNode *ast_create_node(ParseContext *pc, NodeType type, Token *first_token) {84static AstNode *ast_create_node(ParseContext *pc, NodeType type, Token *first_token) {
85 assert(first_token);
84 AstNode *node = ast_create_node_no_line_info(pc, type);86 AstNode *node = ast_create_node_no_line_info(pc, type);
85 ast_update_node_line_info(node, first_token);87 ast_update_node_line_info(node, first_token);
86 return node;88 return node;
...@@ -1541,6 +1543,7 @@ static AstNode *ast_parse_while_expr(ParseContext *pc, size_t *token_index, bool...@@ -1541,6 +1543,7 @@ static AstNode *ast_parse_while_expr(ParseContext *pc, size_t *token_index, bool
1541 return nullptr;1543 return nullptr;
1542 }1544 }
1543 } else if (first_token->id == TokenIdKeywordWhile) {1545 } else if (first_token->id == TokenIdKeywordWhile) {
1546 while_token = first_token;
1544 is_inline = false;1547 is_inline = false;
1545 *token_index += 1;1548 *token_index += 1;
1546 } else if (mandatory) {1549 } else if (mandatory) {