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 /ext/tokenizer/tokenizer_data.c | |
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 'ext/tokenizer/tokenizer_data.c')
-rw-r--r-- | ext/tokenizer/tokenizer_data.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/ext/tokenizer/tokenizer_data.c b/ext/tokenizer/tokenizer_data.c index 3ffef8a55d..474c08be2f 100644 --- a/ext/tokenizer/tokenizer_data.c +++ b/ext/tokenizer/tokenizer_data.c @@ -51,6 +51,7 @@ void tokenizer_register_constants(INIT_FUNC_ARGS) { REGISTER_LONG_CONSTANT("T_SL_EQUAL", T_SL_EQUAL, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("T_SR_EQUAL", T_SR_EQUAL, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("T_POW_EQUAL", T_POW_EQUAL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_COALESCE_EQUAL", T_COALESCE_EQUAL, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("T_COALESCE", T_COALESCE, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("T_BOOLEAN_OR", T_BOOLEAN_OR, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("T_BOOLEAN_AND", T_BOOLEAN_AND, CONST_CS | CONST_PERSISTENT); @@ -191,6 +192,7 @@ char *get_token_type_name(int token_type) case T_SL_EQUAL: return "T_SL_EQUAL"; case T_SR_EQUAL: return "T_SR_EQUAL"; case T_POW_EQUAL: return "T_POW_EQUAL"; + case T_COALESCE_EQUAL: return "T_COALESCE_EQUAL"; case T_COALESCE: return "T_COALESCE"; case T_BOOLEAN_OR: return "T_BOOLEAN_OR"; case T_BOOLEAN_AND: return "T_BOOLEAN_AND"; @@ -304,3 +306,4 @@ char *get_token_type_name(int token_type) } return "UNKNOWN"; } + |