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, - ); - } - -}