Skip to content

Commit 1f4dd65

Browse files
committed
Implemnent braced expression invocation in PHP 5.6
1 parent adb313c commit 1f4dd65

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,20 @@ protected function emitBinary($node) {
8484
}
8585
}
8686

87+
protected function emitInvoke($node) {
88+
if ('braced' === $node->value[0]->arity) {
89+
$t= $this->temp();
90+
$this->out->write('(('.$t.'=');
91+
$this->emit($node->value[0]->value);
92+
$this->out->write(') ? '.$t);
93+
$this->out->write('(');
94+
$this->arguments($node->value[1]);
95+
$this->out->write(') : __error(E_RECOVERABLE_ERROR, "Function name must be a string", __FILE__, __LINE__))');
96+
} else {
97+
parent::emitInvoke($node);
98+
}
99+
}
100+
87101
protected function emitNew($node) {
88102
if (null === $node->value[0]) {
89103
$this->out->write('\\lang\\ClassLoader::defineType("class©anonymous'.md5($node->hashCode()).'", ["kind" => "class"');

0 commit comments

Comments
 (0)