cvs: ZendEngine2 / zend_compile.c
| From: | Zeev Suraski | Date: | Sat, 07 Dec 2002 21:46:13 +0000 |
| Subject: | cvs: ZendEngine2 / zend_compile.c | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-690@lists.php.net to get a copy of this message | ||
zeev Sat Dec 7 16:46:13 2002 EDT
Modified files:
/ZendEngine2 zend_compile.c
Log:
Simplify/fix inheritance checks
Index: ZendEngine2/zend_compile.c
diff -u ZendEngine2/zend_compile.c:1.330 ZendEngine2/zend_compile.c:1.331
--- ZendEngine2/zend_compile.c:1.330 Sat Dec 7 10:51:25 2002
+++ ZendEngine2/zend_compile.c Sat Dec 7 16:46:12 2002
@@ -1587,24 +1587,11 @@
zend_error(E_COMPILE_ERROR, "Cannot make static method %s::%s() non static in class
%s", ZEND_FN_SCOPE_NAME(parent), child->common.function_name, ZEND_FN_SCOPE_NAME(child));
}
}
+
/* Disallow making an inherited method abstract.
- * Also check the visibility and copy it if needed. This must be done last
- * since we may change the child flags here.
- * Again first detect more than one error to make normal operation faster.
*/
- if ((child_flags & (ZEND_FN_PPP_MASK|ZEND_ACC_ABSTRACT)) != (parent_flags &
ZEND_FN_PPP_MASK)) {
- if (child_flags & ZEND_ACC_ABSTRACT) {
- zend_error(E_COMPILE_ERROR, "Cannot redeclare %s::%s() abstract in class %s",
ZEND_FN_SCOPE_NAME(parent), child->common.function_name, ZEND_FN_SCOPE_NAME(child));
- }
- if (!(child_flags & ZEND_FN_PPP_MASK) || (((child_flags|parent_flags) & ZEND_FN_PPP_MASK)
== ZEND_ACC_PUBLIC)) {
- /* this is no error since we copy visibility here */
- /* child->common.fn_flags &= ~ZEND_FN_PPP_MASK; do not clear added public */
- child->common.fn_flags |= parent_flags & ZEND_FN_PPP_MASK;
- } else {
- zend_error(E_COMPILE_ERROR, "Cannot redeclare %s %s::%s() as %s %s::%s()",
- zend_visibility_string(parent_flags), ZEND_FN_SCOPE_NAME(parent),
parent->common.function_name,
- zend_visibility_string(child_flags), ZEND_FN_SCOPE_NAME(child),
child->common.function_name);
- }
+ if ((child_flags & ZEND_ACC_ABSTRACT) && !(parent_flags & ZEND_ACC_ABSTRACT)) {
+ zend_error(E_COMPILE_ERROR, "Cannot make non abstract method %s::%s() abstract in class
%s", ZEND_FN_SCOPE_NAME(parent), child->common.function_name, ZEND_FN_SCOPE_NAME(child));
}
return SUCCESS;
}