com php-src: Fix AST start lineno for list nodes: Zend/zend_a st.c
[email protected] (Nikita Popov)
| Newsgroups | php.cvs |
|---|---|
| Message-ID | <[email protected]> |
Commit: 183cd048f18fa4b04fb30448a84a54cee80a2491 Author: Nikita Popov <[email protected]> Fri, 17 Mar 2017 13:34:18 +0100 Parents: 0c8ad36d924c6ba208eefc02ae09d84cbd683959 Branches: PHP-7.0 PHP-7.1 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=183cd048f18fa4b04fb30448a84a54cee80a2491 Log: Fix AST start lineno for list nodes 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. Changed paths: M Zend/zend_ast.c Diff: diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c index c97e1c4..b55d0e8 100644 --- a/Zend/zend_ast.c +++ b/Zend/zend_ast.c @@ -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); }