protected final function flow(GraphNode $node) { $outBefore = $node->getAttribute(self::ATTR_FLOW_STATE_OUT); $outAfter = $this->branchedFlowThrough($node->getAstNode(), $node->getAttribute(self::ATTR_FLOW_STATE_IN)); $node->setAttribute(self::ATTR_FLOW_STATE_OUT, $outAfter); assert('count($outBefore) === count($outAfter)'); for ($i = 0, $c = count($outBefore); $i < $c; $i++) { if (false === $outBefore[$i]->equals($outAfter[$i])) { return true; } } return false; }
protected function flow(GraphNode $node) { if ($this->isForward()) { $outBefore = $node->getAttribute(self::ATTR_FLOW_STATE_OUT); $outAfter = $this->flowThrough($node->getAstNode(), $node->getAttribute(self::ATTR_FLOW_STATE_IN)); $node->setAttribute(self::ATTR_FLOW_STATE_OUT, $outAfter); return false === $outBefore->equals($outAfter); } $inBefore = $node->getAttribute(self::ATTR_FLOW_STATE_IN); $inAfter = $this->flowThrough($node->getAstNode(), $node->getAttribute(self::ATTR_FLOW_STATE_OUT)); $node->setAttribute(self::ATTR_FLOW_STATE_IN, $inAfter); return false === $inBefore->equals($inAfter); }
private function verifyOutHas(GraphNode $node, Variable $var, $constant) { $fState = $node->getAttribute(DataFlowAnalysis::ATTR_FLOW_STATE_OUT); if (null === $constant) { $this->assertFalse(isset($fState->constMap[$var])); } else { $this->assertTrue(isset($fState->constMap[$var])); $this->assertSame($constant, $fState->constMap[$var]); } }