2015-06-13 16:24:52 +02:00
|
|
|
Yield operator precedence
|
|
|
|
-----
|
|
|
|
<?php
|
|
|
|
|
|
|
|
function gen() {
|
|
|
|
yield "a" . "b";
|
|
|
|
yield "a" or die;
|
|
|
|
yield "k" => "a" . "b";
|
|
|
|
yield "k" => "a" or die;
|
|
|
|
var_dump([yield "k" => "a" . "b"]);
|
|
|
|
yield yield "k1" => yield "k2" => "a" . "b";
|
|
|
|
yield yield "k1" => (yield "k2") => "a" . "b";
|
|
|
|
var_dump([yield "k1" => yield "k2" => "a" . "b"]);
|
|
|
|
var_dump([yield "k1" => (yield "k2") => "a" . "b"]);
|
|
|
|
}
|
|
|
|
-----
|
|
|
|
!!php7
|
|
|
|
array(
|
|
|
|
0: Stmt_Function(
|
|
|
|
byRef: false
|
2017-04-28 19:09:39 +02:00
|
|
|
name: Identifier(
|
|
|
|
name: gen
|
|
|
|
)
|
2015-06-13 16:24:52 +02:00
|
|
|
params: array(
|
|
|
|
)
|
|
|
|
returnType: null
|
|
|
|
stmts: array(
|
2017-01-19 22:25:22 +01:00
|
|
|
0: Stmt_Expression(
|
|
|
|
expr: Expr_Yield(
|
2015-06-13 16:24:52 +02:00
|
|
|
key: null
|
2017-01-19 22:25:22 +01:00
|
|
|
value: Expr_BinaryOp_Concat(
|
|
|
|
left: Scalar_String(
|
|
|
|
value: a
|
|
|
|
)
|
|
|
|
right: Scalar_String(
|
|
|
|
value: b
|
|
|
|
)
|
2015-06-13 16:24:52 +02:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
1: Stmt_Expression(
|
|
|
|
expr: Expr_BinaryOp_LogicalOr(
|
|
|
|
left: Expr_Yield(
|
|
|
|
key: null
|
|
|
|
value: Scalar_String(
|
|
|
|
value: a
|
|
|
|
)
|
2015-06-13 16:24:52 +02:00
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
right: Expr_Exit(
|
|
|
|
expr: null
|
2015-06-13 16:24:52 +02:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
2: Stmt_Expression(
|
|
|
|
expr: Expr_Yield(
|
2015-06-13 16:24:52 +02:00
|
|
|
key: Scalar_String(
|
|
|
|
value: k
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
value: Expr_BinaryOp_Concat(
|
|
|
|
left: Scalar_String(
|
|
|
|
value: a
|
|
|
|
)
|
|
|
|
right: Scalar_String(
|
|
|
|
value: b
|
|
|
|
)
|
2015-06-13 16:24:52 +02:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
3: Stmt_Expression(
|
|
|
|
expr: Expr_BinaryOp_LogicalOr(
|
|
|
|
left: Expr_Yield(
|
|
|
|
key: Scalar_String(
|
|
|
|
value: k
|
|
|
|
)
|
|
|
|
value: Scalar_String(
|
|
|
|
value: a
|
|
|
|
)
|
|
|
|
)
|
|
|
|
right: Expr_Exit(
|
|
|
|
expr: null
|
2015-06-13 16:24:52 +02:00
|
|
|
)
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
)
|
|
|
|
4: Stmt_Expression(
|
|
|
|
expr: Expr_FuncCall(
|
|
|
|
name: Name(
|
|
|
|
parts: array(
|
|
|
|
0: var_dump
|
|
|
|
)
|
|
|
|
)
|
|
|
|
args: array(
|
|
|
|
0: Arg(
|
|
|
|
value: Expr_Array(
|
|
|
|
items: array(
|
|
|
|
0: Expr_ArrayItem(
|
|
|
|
key: null
|
|
|
|
value: Expr_Yield(
|
|
|
|
key: Scalar_String(
|
|
|
|
value: k
|
2015-06-13 16:24:52 +02:00
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
value: Expr_BinaryOp_Concat(
|
|
|
|
left: Scalar_String(
|
|
|
|
value: a
|
|
|
|
)
|
|
|
|
right: Scalar_String(
|
|
|
|
value: b
|
|
|
|
)
|
2015-06-13 16:24:52 +02:00
|
|
|
)
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
byRef: false
|
2019-05-09 15:11:00 +02:00
|
|
|
unpack: false
|
2015-06-13 16:24:52 +02:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
byRef: false
|
|
|
|
unpack: false
|
2015-06-13 16:24:52 +02:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
5: Stmt_Expression(
|
|
|
|
expr: Expr_Yield(
|
|
|
|
key: null
|
2015-06-13 16:24:52 +02:00
|
|
|
value: Expr_Yield(
|
|
|
|
key: Scalar_String(
|
2017-01-19 22:25:22 +01:00
|
|
|
value: k1
|
2015-06-13 16:24:52 +02:00
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
value: Expr_Yield(
|
|
|
|
key: Scalar_String(
|
|
|
|
value: k2
|
2015-06-13 16:24:52 +02:00
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
value: Expr_BinaryOp_Concat(
|
|
|
|
left: Scalar_String(
|
|
|
|
value: a
|
|
|
|
)
|
|
|
|
right: Scalar_String(
|
|
|
|
value: b
|
|
|
|
)
|
2015-06-13 16:24:52 +02:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
6: Stmt_Expression(
|
|
|
|
expr: Expr_Yield(
|
|
|
|
key: Expr_Yield(
|
|
|
|
key: Scalar_String(
|
|
|
|
value: k1
|
|
|
|
)
|
|
|
|
value: Expr_Yield(
|
|
|
|
key: null
|
|
|
|
value: Scalar_String(
|
|
|
|
value: k2
|
|
|
|
)
|
2015-06-13 16:24:52 +02:00
|
|
|
)
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
value: Expr_BinaryOp_Concat(
|
|
|
|
left: Scalar_String(
|
|
|
|
value: a
|
|
|
|
)
|
|
|
|
right: Scalar_String(
|
|
|
|
value: b
|
|
|
|
)
|
2015-06-13 16:24:52 +02:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
7: Stmt_Expression(
|
|
|
|
expr: Expr_FuncCall(
|
|
|
|
name: Name(
|
|
|
|
parts: array(
|
|
|
|
0: var_dump
|
|
|
|
)
|
2015-06-13 16:24:52 +02:00
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
args: array(
|
|
|
|
0: Arg(
|
|
|
|
value: Expr_Array(
|
|
|
|
items: array(
|
|
|
|
0: Expr_ArrayItem(
|
|
|
|
key: null
|
2015-06-13 16:24:52 +02:00
|
|
|
value: Expr_Yield(
|
|
|
|
key: Scalar_String(
|
2017-01-19 22:25:22 +01:00
|
|
|
value: k1
|
2015-06-13 16:24:52 +02:00
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
value: Expr_Yield(
|
|
|
|
key: Scalar_String(
|
|
|
|
value: k2
|
2015-06-13 16:24:52 +02:00
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
value: Expr_BinaryOp_Concat(
|
|
|
|
left: Scalar_String(
|
|
|
|
value: a
|
|
|
|
)
|
|
|
|
right: Scalar_String(
|
|
|
|
value: b
|
|
|
|
)
|
2015-06-13 16:24:52 +02:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
byRef: false
|
2019-05-09 15:11:00 +02:00
|
|
|
unpack: false
|
2015-06-13 16:24:52 +02:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
byRef: false
|
|
|
|
unpack: false
|
2015-06-13 16:24:52 +02:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
8: Stmt_Expression(
|
|
|
|
expr: Expr_FuncCall(
|
|
|
|
name: Name(
|
|
|
|
parts: array(
|
|
|
|
0: var_dump
|
|
|
|
)
|
2015-06-13 16:24:52 +02:00
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
args: array(
|
|
|
|
0: Arg(
|
|
|
|
value: Expr_Array(
|
|
|
|
items: array(
|
|
|
|
0: Expr_ArrayItem(
|
|
|
|
key: Expr_Yield(
|
|
|
|
key: Scalar_String(
|
|
|
|
value: k1
|
|
|
|
)
|
|
|
|
value: Expr_Yield(
|
|
|
|
key: null
|
|
|
|
value: Scalar_String(
|
|
|
|
value: k2
|
|
|
|
)
|
2015-06-13 16:24:52 +02:00
|
|
|
)
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
value: Expr_BinaryOp_Concat(
|
|
|
|
left: Scalar_String(
|
|
|
|
value: a
|
|
|
|
)
|
|
|
|
right: Scalar_String(
|
|
|
|
value: b
|
|
|
|
)
|
2015-06-13 16:24:52 +02:00
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
byRef: false
|
2019-05-09 15:11:00 +02:00
|
|
|
unpack: false
|
2015-06-13 16:24:52 +02:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
byRef: false
|
|
|
|
unpack: false
|
2015-06-13 16:24:52 +02:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
)
|