mirror of
https://github.com/php/php-src.git
synced 2025-08-18 15:08:55 +02:00
Optimize class constant declare compilation
This commit is contained in:
parent
bc28ed6788
commit
badc19d884
1 changed files with 5 additions and 5 deletions
|
@ -4535,6 +4535,11 @@ void zend_compile_class_const_decl(zend_ast *ast) /* {{{ */
|
|||
zend_class_entry *ce = CG(active_class_entry);
|
||||
uint32_t i;
|
||||
|
||||
if ((ce->ce_flags & ZEND_ACC_TRAIT) != 0) {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "Traits cannot have constants");
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < list->children; ++i) {
|
||||
zend_ast *const_ast = list->child[i];
|
||||
zend_ast *name_ast = const_ast->child[0];
|
||||
|
@ -4542,11 +4547,6 @@ void zend_compile_class_const_decl(zend_ast *ast) /* {{{ */
|
|||
zend_string *name = zend_ast_get_str(name_ast);
|
||||
zval value_zv;
|
||||
|
||||
if ((ce->ce_flags & ZEND_ACC_TRAIT) != 0) {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "Traits cannot have constants");
|
||||
return;
|
||||
}
|
||||
|
||||
zend_const_expr_to_zval(&value_zv, value_ast);
|
||||
|
||||
name = zend_new_interned_string_safe(name);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue