com php-src: Store (bad) estimate of lineno with ast: Zend/zend_ast.c Zend/zend_ast.h Zend/zend_compile .c Zend/zend_compile.h

From: Date: Sat, 12 Jul 2014 12:03:42 +0000
Subject: com php-src: Store (bad) estimate of lineno with ast: Zend/zend_ast.c Zend/zend_ast.h Zend/zend_compile .c Zend/zend_compile.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-81006@lists.php.net to get a copy of this message
Commit: 8577f58e525b285e816691668ea714b5b1fc78bc Author: Nikita Popov <nikic@php.net> Sat, 12 Jul 2014 14:03:42 +0200 Parents: e367e68111bb557c00fc008759b8fc7310587843 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=8577f58e525b285e816691668ea714b5b1fc78bc Log: Store (bad) estimate of lineno with ast Currently not used yet Changed paths: M Zend/zend_ast.c M Zend/zend_ast.h M Zend/zend_compile.c M Zend/zend_compile.h Diff: diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c index c07d435..a1ebf77 100644 --- a/Zend/zend_ast.c +++ b/Zend/zend_ast.c @@ -25,18 +25,22 @@ ZEND_API zend_ast *zend_ast_create_znode(znode *node) { + TSRMLS_FETCH(); zend_ast_znode *ast = emalloc(sizeof(zend_ast_znode)); ast->kind = ZEND_AST_ZNODE; ast->attr = 0; + ast->lineno = CG(zend_lineno); ast->node = *node; return (zend_ast *) ast; } ZEND_API zend_ast *zend_ast_create_zval_ex(zval *zv, zend_ast_attr attr) { + TSRMLS_FETCH(); zend_ast_zval *ast = emalloc(sizeof(zend_ast_zval)); ast->kind = ZEND_AST_ZVAL; ast->attr = attr; + ast->lineno = CG(zend_lineno); ZVAL_COPY_VALUE(&ast->val, zv); return (zend_ast *) ast; } @@ -44,11 +48,13 @@ 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(); zend_uint i; zend_ast *ast = emalloc(sizeof(zend_ast) + (children - 1) * sizeof(zend_ast *)); ast->kind = kind; ast->attr = attr; + ast->lineno = CG(zend_lineno); ast->children = children; for (i = 0; i < children; ++i) { @@ -87,9 +93,11 @@ ZEND_API zend_ast *zend_ast_create( ZEND_API zend_ast *zend_ast_create_dynamic(zend_ast_kind kind) { /* use 4 children as default */ + TSRMLS_FETCH(); zend_ast *ast = emalloc(sizeof(zend_ast) + sizeof(zend_ast *) * 3); ast->kind = kind; ast->attr = 0; + ast->lineno = CG(zend_lineno); ast->children = 0; return ast; } diff --git a/Zend/zend_ast.h b/Zend/zend_ast.h index 410fce5..59d383a 100644 --- a/Zend/zend_ast.h +++ b/Zend/zend_ast.h @@ -100,6 +100,7 @@ typedef unsigned short zend_ast_attr; struct _zend_ast { zend_ast_kind kind; /* Type of the node (either opcode or ZEND_AST_* constant) */ zend_ast_attr attr; /* Additional attribute, use depending on node type */ + zend_uint lineno; /* Line number */ zend_uint children; /* Number of children */ zend_ast *child[1]; /* Array of children (using struct hack) */ }; @@ -107,6 +108,7 @@ struct _zend_ast { typedef struct _zend_ast_zval { zend_ast_kind kind; zend_ast_attr attr; + zend_uint lineno; zval val; } zend_ast_zval; diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index ccddfd6..7e36b97 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -8251,6 +8251,9 @@ void zend_compile_stmt(zend_ast *ast TSRMLS_DC) { return; } + // TODO.AST + //CG(zend_lineno) = ast->lineno; + switch (ast->kind) { case ZEND_AST_STMT_LIST: zend_compile_stmt_list(ast TSRMLS_CC); diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index c7d3e06..268a793 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -91,6 +91,7 @@ typedef struct _znode { /* used only during compilation */ typedef struct _zend_ast_znode { zend_ast_kind kind; zend_ast_attr attr; + zend_uint lineno; znode node; } zend_ast_znode; ZEND_API zend_ast *zend_ast_create_znode(znode *node);

« previous php.cvs (#81006) next »