com php-src: Remove duplicate code: Zend/zend_compile.c Z end/zend_compile.h
| From: | Nikita Popov | Date: | Mon, 28 Jul 2014 13:29:56 +0000 |
| Subject: | com php-src: Remove duplicate code: Zend/zend_compile.c Z end/zend_compile.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-80904@lists.php.net to get a copy of this message | ||
Commit: 50aefcf0758b4dda19f803d5ff3f5ceba372f078
Author: Nikita Popov <nikic@php.net> Mon, 28 Jul 2014 15:29:56 +0200
Parents: 2306655214eaea7b15cf1f3327257fbf74d425db
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=50aefcf0758b4dda19f803d5ff3f5ceba372f078
Log:
Remove duplicate code
Changed paths:
M Zend/zend_compile.c
M Zend/zend_compile.h
Diff:
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index f54c2fe..e5e6bed 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -541,39 +541,6 @@ void zend_stop_lexing(TSRMLS_D) {
LANG_SCNG(yy_cursor) = LANG_SCNG(yy_limit);
}
-void zend_do_abstract_method(const znode *function_name, znode *modifiers, const znode *body
TSRMLS_DC) /* {{{ */
-{
- char *method_type;
-
- if (CG(active_class_entry)->ce_flags & ZEND_ACC_INTERFACE) {
- Z_LVAL(modifiers->u.constant) |= ZEND_ACC_ABSTRACT;
- method_type = "Interface";
- } else {
- method_type = "Abstract";
- }
-
- if (Z_LVAL(modifiers->u.constant) & ZEND_ACC_ABSTRACT) {
- if(Z_LVAL(modifiers->u.constant) & ZEND_ACC_PRIVATE) {
- zend_error_noreturn(E_COMPILE_ERROR, "%s function %s::%s() cannot be declared
private", method_type, CG(active_class_entry)->name->val,
Z_STRVAL(function_name->u.constant));
- }
- if (Z_LVAL(body->u.constant) == ZEND_ACC_ABSTRACT) {
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = ZEND_RAISE_ABSTRACT_ERROR;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
- } else {
- /* we had code in the function body */
- zend_error_noreturn(E_COMPILE_ERROR, "%s function %s::%s() cannot contain body",
method_type, CG(active_class_entry)->name->val, Z_STRVAL(function_name->u.constant));
- }
- } else {
- if (Z_LVAL(body->u.constant) == ZEND_ACC_ABSTRACT) {
- zend_error_noreturn(E_COMPILE_ERROR, "Non-abstract method %s::%s() must contain body",
CG(active_class_entry)->name->val, Z_STRVAL(function_name->u.constant));
- }
- }
-}
-/* }}} */
-
static inline void do_begin_loop(TSRMLS_D) /* {{{ */
{
zend_brk_cont_element *brk_cont_element;
@@ -3159,35 +3126,39 @@ void zend_verify_namespace(TSRMLS_D) /* {{{ */
}
/* }}} */
-void zend_do_end_namespace(TSRMLS_D) /* {{{ */
-{
- CG(in_namespace) = 0;
- if (Z_TYPE(CG(current_namespace)) != IS_UNDEF) {
- zval_dtor(&CG(current_namespace));
- ZVAL_UNDEF(&CG(current_namespace));
- }
+static void zend_reset_import_tables(TSRMLS_D) {
if (CG(current_import)) {
zend_hash_destroy(CG(current_import));
efree(CG(current_import));
CG(current_import) = NULL;
}
+
if (CG(current_import_function)) {
zend_hash_destroy(CG(current_import_function));
efree(CG(current_import_function));
CG(current_import_function) = NULL;
}
+
if (CG(current_import_const)) {
zend_hash_destroy(CG(current_import_const));
efree(CG(current_import_const));
CG(current_import_const) = NULL;
}
}
-/* }}} */
+
+static void zend_end_namespace(TSRMLS_D) {
+ CG(in_namespace) = 0;
+ zend_reset_import_tables(TSRMLS_C);
+ if (Z_TYPE(CG(current_namespace)) != IS_UNDEF) {
+ zval_dtor(&CG(current_namespace));
+ ZVAL_UNDEF(&CG(current_namespace));
+ }
+}
void zend_do_end_compilation(TSRMLS_D) /* {{{ */
{
CG(has_bracketed_namespaces) = 0;
- zend_do_end_namespace(TSRMLS_C);
+ zend_end_namespace(TSRMLS_C);
}
/* }}} */
@@ -6321,26 +6292,6 @@ void zend_compile_const_decl(zend_ast *ast TSRMLS_DC) {
}
}
-static void zend_reset_import_tables(TSRMLS_D) {
- if (CG(current_import)) {
- zend_hash_destroy(CG(current_import));
- efree(CG(current_import));
- CG(current_import) = NULL;
- }
-
- if (CG(current_import_function)) {
- zend_hash_destroy(CG(current_import_function));
- efree(CG(current_import_function));
- CG(current_import_function) = NULL;
- }
-
- if (CG(current_import_const)) {
- zend_hash_destroy(CG(current_import_const));
- efree(CG(current_import_const));
- CG(current_import_const) = NULL;
- }
-}
-
void zend_compile_namespace(zend_ast *ast TSRMLS_DC) {
zend_ast *name_ast = ast->child[0];
zend_ast *stmt_ast = ast->child[1];
@@ -6406,14 +6357,7 @@ void zend_compile_namespace(zend_ast *ast TSRMLS_DC) {
if (stmt_ast) {
zend_compile_top_stmt(stmt_ast TSRMLS_CC);
-
- CG(in_namespace) = 0;
- zend_reset_import_tables(TSRMLS_C);
-
- if (Z_TYPE(CG(current_namespace)) != IS_UNDEF) {
- zval_dtor(&CG(current_namespace));
- ZVAL_UNDEF(&CG(current_namespace));
- }
+ zend_end_namespace(TSRMLS_C);
}
}
diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h
index 69a65fe..a637d4c 100644
--- a/Zend/zend_compile.h
+++ b/Zend/zend_compile.h
@@ -501,8 +501,6 @@ void zend_do_extended_info(TSRMLS_D);
void zend_do_extended_fcall_begin(TSRMLS_D);
void zend_do_extended_fcall_end(TSRMLS_D);
-void zend_do_abstract_method(const znode *function_name, znode *modifiers, const znode *body
TSRMLS_DC);
-
void zend_do_end_namespace(TSRMLS_D);
void zend_verify_namespace(TSRMLS_D);
void zend_do_end_compilation(TSRMLS_D);