protected function expressionToPattern($node) { if ($node instanceof Node\ArrayExpression
) { $loc =
$node->location;
$elems = array
();
foreach ($node->
getElements() as $elem) { $elems[] =
$this->
expressionToPattern($elem);
} $retNode =
$this->
createNode("ArrayPattern",
$loc->start
);
$retNode->
setElements($elems);
$this->
completeNode($retNode,
$loc->end
);
} elseif ($node instanceof Node\ObjectExpression
) { $loc =
$node->location;
$props = array
();
foreach ($node->
getProperties() as $prop) { $props[] =
$this->
expressionToPattern($prop);
} $retNode =
$this->
createNode("ObjectPattern",
$loc->start
);