diff options
| author | Dmitry Stogov <dmitry@zend.com> | 2013-11-06 22:21:07 +0400 |
|---|---|---|
| committer | Dmitry Stogov <dmitry@zend.com> | 2013-11-06 22:21:07 +0400 |
| commit | 9647c61dc101b9d460259fedb3731026f0390eeb (patch) | |
| tree | c002ea1be17965f999c1b801b48dbfd3788c962d /Zend/zend_compile.c | |
| parent | af600c240d2efe33291e8dd71ce228b9fbc849c1 (diff) | |
| download | php-git-9647c61dc101b9d460259fedb3731026f0390eeb.tar.gz | |
Constant expressions refactoring
Diffstat (limited to 'Zend/zend_compile.c')
| -rw-r--r-- | Zend/zend_compile.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 77da945153..07a9ae88d0 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -5793,8 +5793,8 @@ void zend_do_add_static_array_element(znode *result, znode *offset, const znode key[len + 1] = 0; zend_symtable_update(Z_ARRVAL(result->u.constant), key, len + 2, &element, sizeof(zval *), NULL); efree(key); + break; } - break; case IS_STRING: zend_symtable_update(Z_ARRVAL(result->u.constant), Z_STRVAL(offset->u.constant), Z_STRLEN(offset->u.constant)+1, &element, sizeof(zval *), NULL); zval_dtor(&offset->u.constant); @@ -7133,6 +7133,21 @@ void zend_do_end_compilation(TSRMLS_D) /* {{{ */ } /* }}} */ +void zend_do_constant_expression(znode *result, zend_ast *ast TSRMLS_DC) /* {{{ */ +{ + if (ast->kind == ZEND_CONST) { + result->u.constant = *ast->u.val; + efree(ast); + } else if (zend_ast_is_ct_constant(ast)) { + zend_ast_evaluate(&result->u.constant, ast TSRMLS_CC); + zend_ast_destroy(ast); + } else { + Z_TYPE(result->u.constant) = IS_CONSTANT_AST; + Z_AST(result->u.constant) = ast; + } +} +/* }}} */ + /* {{{ zend_dirname Returns directory name component of path */ ZEND_API size_t zend_dirname(char *path, size_t len) |
