public function getTargetsFromRegistry($registry) { $className = $this->receiverClassNameToken->getText(); $functionName = $this->receiverFunctionNameToken->getText(); $identifier = OA_FunctionRegistry::createNameForStaticFunction($className, $functionName); $target = $registry->resolveStaticReceiverForName($identifier); return null !== $target ? array($target) : array(); }
public function getTargetsFromRegistry($registry) { $target = null; $className = $this->receiverClassNameToken->getText(); while (null === $target && null !== $className) { $identifier = OA_FunctionRegistry::createNameForConstructor($className); $target = $registry->resolveStaticReceiverForName($identifier); // If we failed to find the receiver, try the superclass. if (null === $target) { $className = $registry->getSuperclassName($className); } } return null !== $target ? array($target) : array(); }
public function performDeadCodeElimination() { // Build the connections between caller and receiver ("mark"). $registry = new OA_FunctionRegistry(); foreach ($this->functionObjects as $functionObject) { $registry->registerNormalFunction($functionObject->getName(), $functionObject); } foreach ($this->classObjects as $classObject) { $classObject->registerAllFunctions($registry); } OA_SymbolTableBuilder::_markAllCalls($registry, $this->functionCallObjects); foreach ($this->classObjects as $classObject) { $exportedCalls = $classObject->getAllExportedCalls(); OA_SymbolTableBuilder::_markAllCalls($registry, $exportedCalls); } // Now delete all dead receivers ("sweep"). foreach ($this->functionObjects as $functionObject) { $functionObject->cleanIfDead(); } foreach ($this->classObjects as $classObject) { $classObject->cleanDeadFunctions(); } }