com php-src: approx correct linenos in errors: Zend/zend_ast .c Zend/zend_compile.c

From: Date: Sat, 12 Jul 2014 15:10:10 +0000
Subject: com php-src: approx correct linenos in errors: Zend/zend_ast .c Zend/zend_compile.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-81003@lists.php.net to get a copy of this message
Commit: 069da161cfb6328b512ee07d0c71b8348f54cf96 Author: Nikita Popov <nikic@php.net> Sat, 12 Jul 2014 17:10:10 +0200 Parents: c58079b4fda6c23f112347ab208038480cfd6704 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=069da161cfb6328b512ee07d0c71b8348f54cf96 Log: approx correct linenos in errors Changed paths: M Zend/zend_ast.c M Zend/zend_compile.c Diff: diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c index a1ebf77..5ef590d 100644 --- a/Zend/zend_ast.c +++ b/Zend/zend_ast.c @@ -48,19 +48,27 @@ ZEND_API zend_ast *zend_ast_create_zval_ex(zval *zv, zend_ast_attr attr) static zend_ast *zend_ast_create_from_va_list( zend_uint children, zend_ast_kind kind, zend_ast_attr attr, va_list va ) { - TSRMLS_FETCH(); + /*TSRMLS_FETCH();*/ zend_uint i; - - zend_ast *ast = emalloc(sizeof(zend_ast) + (children - 1) * sizeof(zend_ast *)); + zend_ast *ast; + + ast = emalloc(sizeof(zend_ast) + (children - 1) * sizeof(zend_ast *)); ast->kind = kind; ast->attr = attr; - ast->lineno = CG(zend_lineno); + ast->lineno = 0; ast->children = children; for (i = 0; i < children; ++i) { ast->child[i] = va_arg(va, zend_ast *); + if (ast->lineno == 0 && ast->child[i] != NULL) { + ast->lineno = ast->child[i]->lineno; + } } + /*if (ast->lineno == 0) { + ast->lineno = CG(zend_lineno); + }*/ + return ast; } diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 4f190d7..b1e5a8c 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -8310,7 +8310,8 @@ void zend_compile_stmt(zend_ast *ast TSRMLS_DC) { } // TODO.AST - //CG(zend_lineno) = ast->lineno; + zend_uint orig_lineno = CG(zend_lineno); + CG(zend_lineno) = ast->lineno; switch (ast->kind) { case ZEND_AST_STMT_LIST: @@ -8376,6 +8377,8 @@ void zend_compile_stmt(zend_ast *ast TSRMLS_DC) { if (Z_LVAL(CG(declarables).ticks) && !zend_is_unticked_stmt(ast)) { zend_emit_tick(TSRMLS_C); } + + CG(zend_lineno) = orig_lineno; } void zend_compile_expr(znode *result, zend_ast *ast TSRMLS_DC) {

« previous php.cvs (#81003) next »