diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2017-03-17 13:34:18 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2017-03-17 13:35:24 +0100 |
commit | 183cd048f18fa4b04fb30448a84a54cee80a2491 (patch) | |
tree | c9f04dd05a168298b93460912382fa6645e7ecc7 /Zend | |
parent | 0c8ad36d924c6ba208eefc02ae09d84cbd683959 (diff) | |
download | php-git-183cd048f18fa4b04fb30448a84a54cee80a2491.tar.gz |
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.
Diffstat (limited to 'Zend')
-rw-r--r-- | Zend/zend_ast.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c index c97e1c4ffe..b55d0e8a3b 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); } |