diff options
| author | Nikita Popov <nikita.ppv@gmail.com> | 2019-01-15 17:04:24 +0100 |
|---|---|---|
| committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-01-22 11:12:04 +0100 |
| commit | a50198d0fef652ca052cda642d6e98a9101eb73f (patch) | |
| tree | 8bd51746c7418ae0826d527eb57fbebdb67b05d7 /Zend/zend_vm_def.h | |
| parent | 50ddff94b9989342e66678c311b3abf4e7d5a074 (diff) | |
| download | php-git-a50198d0fef652ca052cda642d6e98a9101eb73f.tar.gz | |
Implement ??= operator
RFC: https://wiki.php.net/rfc/null_coalesce_equal_operator
$a ??= $b is $a ?? ($a = $b), with the difference that $a is only
evaluated once, to the degree that this is possible. In particular
in $a[foo()] ?? $b function foo() is only ever called once.
However, the variable access themselves will be reevaluated.
Diffstat (limited to 'Zend/zend_vm_def.h')
| -rw-r--r-- | Zend/zend_vm_def.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index ed62b123cf..e03133d2da 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -8449,6 +8449,16 @@ ZEND_VM_HANDLER(195, ZEND_FUNC_GET_ARGS, UNUSED|CONST, UNUSED) ZEND_VM_NEXT_OPCODE(); } +ZEND_VM_HANDLER(207, ZEND_COPY_TMP, TMPVAR, UNUSED) +{ + USE_OPLINE + zend_free_op free_op1; + zval *value = GET_OP1_ZVAL_PTR(BP_VAR_R); + zval *result = EX_VAR(opline->result.var); + ZVAL_COPY(result, value); + ZEND_VM_NEXT_OPCODE(); +} + ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_JMP, (OP_JMP_ADDR(op, op->op1) > op), ZEND_JMP_FORWARD, JMP_ADDR, ANY) { USE_OPLINE |
