Skip to content

Commit de5a4f7

Browse files
committed
- Add reflection helpers
1 parent 50ce72f commit de5a4f7

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

Zend/zend_closures.c

+14
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,20 @@ ZEND_API zend_function *zend_get_closure_invoke_method(zval *obj TSRMLS_DC) /* {
107107
}
108108
/* }}} */
109109

110+
ZEND_API const zend_function *zend_get_closure_method_def(zval *obj TSRMLS_DC)
111+
{
112+
zend_closure *closure = (zend_closure *)zend_object_store_get_object(obj TSRMLS_CC);
113+
return &closure->func;
114+
}
115+
/* }}} */
116+
117+
ZEND_API zval* zend_get_closure_this_ptr(zval *obj TSRMLS_DC) /* {{{ */
118+
{
119+
zend_closure *closure = (zend_closure *)zend_object_store_get_object(obj TSRMLS_CC);
120+
return closure->this_ptr;
121+
}
122+
/* }}} */
123+
110124
static zend_function *zend_closure_get_method(zval **object_ptr, zstr method_name, int method_len TSRMLS_DC) /* {{{ */
111125
{
112126
unsigned int lc_name_len;

Zend/zend_closures.h

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ extern ZEND_API zend_class_entry *zend_ce_closure;
3333
ZEND_API void zend_create_closure(zval *res, zend_function *op_array, zend_class_entry *scope, zval *this_ptr TSRMLS_DC);
3434
ZEND_API int zend_get_closure(zval *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zval **zobj_ptr TSRMLS_DC);
3535
ZEND_API zend_function *zend_get_closure_invoke_method(zval *obj TSRMLS_DC);
36+
ZEND_API const zend_function *zend_get_closure_method_def(zval *obj TSRMLS_DC);
37+
ZEND_API zval* zend_get_closure_this_ptr(zval *obj TSRMLS_DC);
3638

3739
END_EXTERN_C()
3840

0 commit comments

Comments
 (0)