From a235a041e5e2345db4457d580ad0fbd4b99d2bc0 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 26 Jun 2012 18:22:36 -0700 Subject: [PATCH] Remove PhutilModuleRequirements Summary: Yeah, we can nuke this. Test Plan: Grepped for callsites. Reviewers: vrana Reviewed By: vrana CC: aran Maniphest Tasks: T1103 Differential Revision: https://secure.phabricator.com/D2871 --- .divinerconfig | 1 - src/__phutil_library_map__.php | 1 - src/parser/PhutilModuleRequirements.php | 177 ------------------------ 3 files changed, 179 deletions(-) delete mode 100644 src/parser/PhutilModuleRequirements.php diff --git a/.divinerconfig b/.divinerconfig index 56e1cf23..0325d0fb 100644 --- a/.divinerconfig +++ b/.divinerconfig @@ -13,7 +13,6 @@ "diff" : "Diff and Changeset APIs", "differential" : "Differential Integration", "workingcopy" : "Working Copy APIs", - "module" : "Phutil Module System", "testcase" : "Test Cases" }, "engines" : [ diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 8b1178d7..fdfda1a8 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -130,7 +130,6 @@ phutil_register_library_map(array( 'NoseTestEngine' => 'unit/engine/NoseTestEngine.php', 'PhpunitTestEngine' => 'unit/engine/PhpunitTestEngine.php', 'PhutilLintEngine' => 'lint/engine/PhutilLintEngine.php', - 'PhutilModuleRequirements' => 'parser/PhutilModuleRequirements.php', 'PhutilUnitTestEngine' => 'unit/engine/PhutilUnitTestEngine.php', 'PhutilUnitTestEngineTestCase' => 'unit/engine/__tests__/PhutilUnitTestEngineTestCase.php', 'UnitTestableArcanistLintEngine' => 'lint/engine/UnitTestableArcanistLintEngine.php', diff --git a/src/parser/PhutilModuleRequirements.php b/src/parser/PhutilModuleRequirements.php deleted file mode 100644 index 4b50e4b9..00000000 --- a/src/parser/PhutilModuleRequirements.php +++ /dev/null @@ -1,177 +0,0 @@ - array(), - 'interface' => array(), - 'function' => array(), - ); - - protected $requires = array( - 'class' => array(), - 'interface' => array(), - 'function' => array(), - 'source' => array(), - 'module' => array(), - ); - - protected $declares = array( - 'class' => array(), - 'interface' => array(), - 'function' => array(), - 'source' => array(), - ); - - protected $chain = array( - ); - - protected $currentFile; - protected $messages = array( - ); - - public function setCurrentFile($current_file) { - $this->currentFile = $current_file; - return $this; - } - - protected function getCurrentFile() { - return $this->currentFile; - } - - protected function getWhere(XHPASTNode $where) { - return $this->getCurrentFile().':'.$where->getOffset(); - } - - public function addClassDeclaration(XHPASTNode $where, $name) { - return $this->addDeclaration('class', $where, $name); - } - - public function addFunctionDeclaration(XHPASTNode $where, $name) { - return $this->addDeclaration('function', $where, $name); - } - - public function addInterfaceDeclaration(XHPASTNode $where, $name) { - return $this->addDeclaration('interface', $where, $name); - } - - public function addSourceDeclaration($name) { - $this->declares['source'][$name] = true; - return $this; - } - - protected function addDeclaration($type, XHPASTNode $where, $name) { - $this->declares[$type][$name] = $this->getWhere($where); - return $this; - } - - protected function addDependency($type, XHPASTNode $where, $name) { - if (isset($this->builtins[$type][$name])) { - return $this; - } - if (empty($this->requires[$type][$name])) { - $this->requires[$type][$name] = array(); - } - $this->requires[$type][$name][] = $this->getWhere($where); - return $this; - } - - public function addClassDependency($child, XHPASTNode $where, $name) { - if ($child !== null) { - if (empty($this->builtins['class'][$name])) { - $this->chain['class'][$child] = $name; - } - } - return $this->addDependency('class', $where, $name); - } - - public function addFunctionDependency(XHPASTNode $where, $name) { - return $this->addDependency('function', $where, $name); - } - - public function addInterfaceDependency($child, XHPASTNode $where, $name) { - if ($child !== null) { - if (empty($this->builtins['interface'][$name])) { - $this->chain['interface'][$child][] = $name; - } - } - return $this->addDependency('interface', $where, $name); - } - - public function addSourceDependency(XHPASTNode $where, $name) { - return $this->addDependency('source', $where, $name); - } - - public function addModuleDependency(XHPASTNode $where, $name) { - return $this->addDependency('module', $where, $name); - } - - public function addBuiltins(array $builtins) { - foreach ($builtins as $type => $symbol_set) { - $this->builtins[$type] += $symbol_set; - } - return $this; - } - - public function addRawLint($code, $message) { - $this->messages[] = array( - null, - null, - $code, - $message); - return $this; - } - - public function addLint(XHPASTNode $where, $text, $code, $message) { - $this->messages[] = array( - $this->getWhere($where), - $text, - $code, - $message); - return $this; - } - - public function toDictionary() { - - // Remove all dependencies on things which we declare since they're never - // useful and guaranteed to be satisfied. - foreach ($this->declares as $type => $things) { - if ($type == 'source') { - // Source is treated specially since we only reconcile it locally. - continue; - } - foreach ($things as $name => $where) { - unset($this->requires[$type][$name]); - } - } - - return array( - 'declares' => $this->declares, - 'requires' => $this->requires, - 'chain' => $this->chain, - 'messages' => $this->messages, - ); - } - -}