Add first-class callables

Support acquiring a Closure to a callable using the syntax
func(...), $obj->method(...), etc. This is essentially a
shortcut for Closure::fromCallable().

RFC: https://wiki.php.net/rfc/first_class_callable_syntax

Closes GH-7019.

Co-Authored-By: Nikita Popov <nikita.ppv@gmail.com>
This commit is contained in:
Joe Watkins 2021-05-20 08:14:56 +02:00 committed by Nikita Popov
parent 42cb5b5fa8
commit d0b09a7be4
40 changed files with 1078 additions and 515 deletions

View file

@ -22,7 +22,7 @@
#include <zend.h>
#include <zend_vm_opcodes.h>
static const char *zend_vm_opcodes_names[202] = {
static const char *zend_vm_opcodes_names[203] = {
"ZEND_NOP",
"ZEND_ADD",
"ZEND_SUB",
@ -225,9 +225,10 @@ static const char *zend_vm_opcodes_names[202] = {
"ZEND_CHECK_UNDEF_ARGS",
"ZEND_FETCH_GLOBALS",
"ZEND_VERIFY_NEVER_TYPE",
"ZEND_CALLABLE_CONVERT",
};
static uint32_t zend_vm_opcodes_flags[202] = {
static uint32_t zend_vm_opcodes_flags[203] = {
0x00000000,
0x00000b0b,
0x00000b0b,
@ -430,6 +431,7 @@ static uint32_t zend_vm_opcodes_flags[202] = {
0x00000101,
0x00000101,
0x00000101,
0x00000101,
};
ZEND_API const char* ZEND_FASTCALL zend_get_opcode_name(zend_uchar opcode) {