Re: [patch] final use only for methods

From: Date: Sat, 19 Apr 2003 17:46:25 +0000
Subject: Re: [patch] final use only for methods
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-981@lists.php.net to get a copy of this message
On Sat, 2003-04-19 at 18:17, Sterling Hughes wrote: > The attached patch modifies zend_language_parser, having it generate a > compiler error when final is used on a class property (since we are only > allowing it for methods.) You could then also drop: if (parent_info->flags & ZEND_ACC_FINAL) { zend_error(E_COMPILE_ERROR, "Cannot override final property %s::$%s", parent_ce->name, hash_key->arKey); } and if (((current_access_type->u.constant.value.lval | new_modifier->u.constant.value.lval) & (ZEND_ACC_ABSTRACT | ZEND_ACC_FINAL)) == (ZEND_ACC_ABSTRACT | ZEND_ACC_FINAL)) { zend_error(E_COMPILE_ERROR, "Cannot use the final modifier on an abstract class member"); } and if (((current_access_type->u.constant.value.lval | new_modifier->u.constant.value.lval) & (ZEND_ACC_PRIVATE | ZEND_ACC_FINAL)) == (ZEND_ACC_PRIVATE | ZEND_ACC_FINAL)) { zend_error(E_COMPILE_ERROR, "Cannot use the final modifier on a private class member"); } from zend_compile.c - Timm

« previous php.internals (#981) next »