1
0
mirror of https://github.com/danog/PHP-Parser.git synced 2025-01-22 05:41:23 +01:00

Multiple init test for for loop

This commit is contained in:
Aydin 2015-10-01 16:32:51 +01:00 committed by Nikita Popov
parent 99e89743bd
commit 2b9c5a62cb

View File

@ -5,6 +5,9 @@ For loop
// "classical" loop
for ($i = 0; $i < $c; ++$i) {}
// "classical" loop + multiple init
for ($i = 0, $j = 0; $i < $c; ++$i) {}
// multiple expressions
for (;$a,$b;) {}
@ -49,16 +52,39 @@ array(
)
1: Stmt_For(
init: array(
0: Expr_Assign(
var: Expr_Variable(
name: i
)
expr: Scalar_LNumber(
value: 0
)
)
1: Expr_Assign(
var: Expr_Variable(
name: j
)
expr: Scalar_LNumber(
value: 0
)
)
)
cond: array(
0: Expr_Variable(
name: a
)
1: Expr_Variable(
name: b
0: Expr_BinaryOp_Smaller(
left: Expr_Variable(
name: i
)
right: Expr_Variable(
name: c
)
)
)
loop: array(
0: Expr_PreInc(
var: Expr_Variable(
name: i
)
)
)
stmts: array(
)
@ -67,6 +93,12 @@ array(
init: array(
)
cond: array(
0: Expr_Variable(
name: a
)
1: Expr_Variable(
name: b
)
)
loop: array(
)
@ -83,4 +115,14 @@ array(
stmts: array(
)
)
4: Stmt_For(
init: array(
)
cond: array(
)
loop: array(
)
stmts: array(
)
)
)