/** * @covers ::__construct * @covers ::getVariables * @covers ::getReturnType * @covers ::getGraph */ public function testBasic() { $vertex = new Function_([$a = new Variable()], $t = new Type(Type::TYPE_LONG), $g = new DirectedAdjacencyList()); $this->assertSame([$a], $vertex->getVariables()); $this->assertSame($t, $vertex->getReturnType()); $this->assertSame($g, $vertex->getGraph()); }
public function generateFunction($name, Vertex\Function_ $func) { $state = (object) ['scope' => new \SplObjectStorage(), 'labels' => new \SplObjectStorage(), 'varidx' => 0, 'labelidx' => 0, 'seen' => new \SplObjectStorage(), 'graph' => $func->getGraph()]; return 'function ' . $name . ' ' . $func->getReturnType() . "\n" . $this->generate($func, $state) . "end"; }