-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Use attribute validator for assigning flags #19465
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Oh, I just noticed this has significant overlap with #18817 (which I only went to review right after this PR). |
f3bf298
to
49b4e45
Compare
I'd prefer to do #18817 first since that is for an RFC |
@@ -70,7 +70,8 @@ typedef struct _zend_attribute { | |||
typedef struct _zend_internal_attribute { | |||
zend_class_entry *ce; | |||
uint32_t flags; | |||
void (*validator)(zend_attribute *attr, uint32_t target, zend_class_entry *scope); | |||
/* Parameter offsets start at 1, everything else uses 0. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we shouldn't need both scope
and target
if (target_type & (ZEND_ATTRIBUTE_TARGET_FUNCTION|ZEND_ATTRIBUTE_TARGET_METHOD)) { | ||
zend_op_array *op_array = target; | ||
op_array->fn_flags |= ZEND_ACC_DEPRECATED; | ||
} else if (target_type & (ZEND_ATTRIBUTE_TARGET_CLASS_CONST)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} else if (target_type & (ZEND_ATTRIBUTE_TARGET_CLASS_CONST)) { | |
} else if (target_type & ZEND_ATTRIBUTE_TARGET_CLASS_CONST) { |
ZEND_CLASS_CONST_FLAGS(c) |= ZEND_ACC_DEPRECATED; | ||
/* For deprecated constants, we need to flag the zval for recursion | ||
* detection. Make sure the zval is separated out of shm. */ | ||
scope->ce_flags |= ZEND_ACC_HAS_AST_CONSTANTS; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after removing the separate scope
, can use
scope->ce_flags |= ZEND_ACC_HAS_AST_CONSTANTS; | |
c->ce->ce_flags |= ZEND_ACC_HAS_AST_CONSTANTS; |
and similar for the removal of ZEND_ACC_CONSTANTS_UPDATED
We should also move the |
That's ok with me. Though it makes your patch a bit more complicated, parts of it we might want to revert again. |
No description provided.