Skip to content

Commit

Permalink
Fix AST start lineno for list nodes
Browse files Browse the repository at this point in the history
If the node is initialized with children, check if a child has a
lower start lineno, similar to what we do for fixed-sized nodes
as well.
  • Loading branch information
nikic committed Mar 17, 2017
1 parent 0c8ad36 commit 183cd04
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Zend/zend_ast.c
Expand Up @@ -155,7 +155,14 @@ ZEND_API zend_ast *zend_ast_create_list(uint32_t init_children, zend_ast_kind ki
uint32_t i;
va_start(va, kind);
for (i = 0; i < init_children; ++i) {
ast = zend_ast_list_add(ast, va_arg(va, zend_ast *));
zend_ast *child = va_arg(va, zend_ast *);
ast = zend_ast_list_add(ast, child);
if (child != NULL) {
uint32_t lineno = zend_ast_get_lineno(child);
if (lineno < ast->lineno) {
ast->lineno = lineno;
}
}
}
va_end(va);
}
Expand Down

0 comments on commit 183cd04

Please sign in to comment.