Skip to content

Commit adfc2cf

Browse files
committed
fixes leafo#301 - implement keywords()
1 parent a070856 commit adfc2cf

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/Compiler.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4687,6 +4687,22 @@ protected function libMapMerge($args)
46874687
return array(Type::T_MAP, array_merge($map1[1], $map2[1]), array_merge($map1[2], $map2[2]));
46884688
}
46894689

4690+
protected static $libKeywords = array('args');
4691+
protected function libKeywords($args)
4692+
{
4693+
$this->assertList($args[0]);
4694+
4695+
$keys = array();
4696+
$values = array();
4697+
4698+
foreach ($args[0][2] as $name => $arg) {
4699+
$keys[] = array(Type::T_KEYWORD, $name);
4700+
$values[] = $arg;
4701+
}
4702+
4703+
return array(Type::T_MAP, $keys, $values);
4704+
}
4705+
46904706
protected function listSeparatorForJoin($list1, $sep)
46914707
{
46924708
if (! isset($sep)) {

0 commit comments

Comments
 (0)