Skip to content

Commit e0efb68

Browse files
committed
Fix list() expression emittance for PHP 5.6 and PHP 7.0
1 parent 7fb9949 commit e0efb68

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/main/php/lang/ast/emit/PHP56.class.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,10 @@ protected function emitConst($node) {
111111
protected function emitAssignment($node) {
112112
if ('array' === $node->value[0]->arity) {
113113
$this->out->write('list(');
114-
$this->arguments($node->value[0]->value);
114+
foreach ($node->value[0]->value as $expr) {
115+
$this->emit($expr[1]);
116+
$this->out->write(',');
117+
}
115118
$this->out->write(')');
116119
$this->out->write($node->symbol->id);
117120
$this->emit($node->value[1]);

src/main/php/lang/ast/emit/PHP70.class.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ protected function catches($catch) {
3434
protected function emitAssignment($node) {
3535
if ('array' === $node->value[0]->arity) {
3636
$this->out->write('list(');
37-
$this->arguments($node->value[0]->value);
37+
foreach ($node->value[0]->value as $expr) {
38+
$this->emit($expr[1]);
39+
$this->out->write(',');
40+
}
3841
$this->out->write(')');
3942
$this->out->write($node->symbol->id);
4043
$this->emit($node->value[1]);

0 commit comments

Comments
 (0)