Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15416229
D13373.id32377.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
6 KB
Referenced Files
None
Subscribers
None
D13373.id32377.diff
View Options
diff --git a/src/__phutil_library_init__.php b/src/__phutil_library_init__.php
--- a/src/__phutil_library_init__.php
+++ b/src/__phutil_library_init__.php
@@ -17,7 +17,6 @@
try {
$loader = new PhutilSymbolLoader();
$symbols = $loader
- ->setType('class')
->setName($class_name)
->selectAndLoadSymbols();
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -253,7 +253,6 @@
'PhutilParserGeneratorException' => 'parser/generator/exception/PhutilParserGeneratorException.php',
'PhutilParserGeneratorTestCase' => 'parser/__tests__/PhutilParserGeneratorTestCase.php',
'PhutilPayPalAPIFuture' => 'future/paypal/PhutilPayPalAPIFuture.php',
- 'PhutilPerson' => 'internationalization/PhutilPerson.php',
'PhutilPersonTest' => 'internationalization/__tests__/PhutilPersonTest.php',
'PhutilPersonaAuthAdapter' => 'auth/PhutilPersonaAuthAdapter.php',
'PhutilPhabricatorAuthAdapter' => 'auth/PhutilPhabricatorAuthAdapter.php',
@@ -264,7 +263,6 @@
'PhutilProxyException' => 'error/PhutilProxyException.php',
'PhutilPygmentsSyntaxHighlighter' => 'markup/syntax/highlighter/PhutilPygmentsSyntaxHighlighter.php',
'PhutilPythonFragmentLexer' => 'lexer/PhutilPythonFragmentLexer.php',
- 'PhutilQsprintfInterface' => 'xsprintf/PhutilQsprintfInterface.php',
'PhutilQueryStringParser' => 'parser/PhutilQueryStringParser.php',
'PhutilQueryStringParserTestCase' => 'parser/__tests__/PhutilQueryStringParserTestCase.php',
'PhutilRainbowSyntaxHighlighter' => 'markup/syntax/highlighter/PhutilRainbowSyntaxHighlighter.php',
@@ -304,7 +302,6 @@
'PhutilRope' => 'utils/PhutilRope.php',
'PhutilRopeTestCase' => 'utils/__tests__/PhutilRopeTestCase.php',
'PhutilSafeHTML' => 'markup/PhutilSafeHTML.php',
- 'PhutilSafeHTMLProducerInterface' => 'markup/PhutilSafeHTMLProducerInterface.php',
'PhutilSafeHTMLTestCase' => 'markup/__tests__/PhutilSafeHTMLTestCase.php',
'PhutilSaturateStdoutDaemon' => 'daemon/torture/PhutilSaturateStdoutDaemon.php',
'PhutilServiceProfiler' => 'serviceprofiler/PhutilServiceProfiler.php',
@@ -486,6 +483,11 @@
'xsprintf_terminal' => 'xsprintf/tsprintf.php',
'xsprintf_uri' => 'xsprintf/urisprintf.php',
),
+ 'interface' => array(
+ 'PhutilPerson' => 'internationalization/PhutilPerson.php',
+ 'PhutilQsprintfInterface' => 'xsprintf/PhutilQsprintfInterface.php',
+ 'PhutilSafeHTMLProducerInterface' => 'markup/PhutilSafeHTMLProducerInterface.php',
+ ),
'xmap' => array(
'AASTNode' => 'Phobject',
'AASTNodeList' => array(
diff --git a/src/moduleutils/PhutilLibraryMapBuilder.php b/src/moduleutils/PhutilLibraryMapBuilder.php
--- a/src/moduleutils/PhutilLibraryMapBuilder.php
+++ b/src/moduleutils/PhutilLibraryMapBuilder.php
@@ -278,12 +278,15 @@
* Build a map of all source files in a library to hashes of their content.
* Returns an array like this:
*
- * array(
- * 'src/parser/ExampleParser.php' => '60b725f10c9c85c70d97880dfe8191b3',
- * // ...
- * );
+ * ```lang=php
+ * array(
+ * 'src/parser/ExampleParser.php' => '60b725f10c9c85c70d97880dfe8191b3',
+ * // ...
+ * );
+ * ```
*
* @return dict Map of library-relative paths to content hashes.
+ *
* @task source
*/
private function loadSourceFileMap() {
@@ -335,11 +338,13 @@
*
* @param dict Symbol analysis of all source files.
* @return dict Library map.
+ *
* @task source
*/
private function buildLibraryMap(array $symbol_map) {
$library_map = array(
'class' => array(),
+ 'interface' => array(),
'function' => array(),
'xmap' => array(),
);
@@ -348,9 +353,8 @@
foreach ($symbol_map as $file => $info) {
foreach ($info['have'] as $type => $symbols) {
foreach ($symbols as $symbol => $declaration) {
- $lib_type = ($type == 'interface') ? 'class' : $type;
- if (!empty($library_map[$lib_type][$symbol])) {
- $prior = $library_map[$lib_type][$symbol];
+ if (!empty($library_map[$type][$symbol])) {
+ $prior = $library_map[$type][$symbol];
throw new Exception(
pht(
"Definition of %s '%s' in file '%s' duplicates prior ".
@@ -361,7 +365,7 @@
$file,
$prior));
}
- $library_map[$lib_type][$symbol] = $file;
+ $library_map[$type][$symbol] = $file;
}
}
$library_map['xmap'] += $info['xmap'];
@@ -388,7 +392,7 @@
/**
* Write a finalized library map.
*
- * @param dict Library map structure to write.
+ * @param dict Library map structure to write.
* @return void
*
* @task source
diff --git a/src/symbols/PhutilSymbolLoader.php b/src/symbols/PhutilSymbolLoader.php
--- a/src/symbols/PhutilSymbolLoader.php
+++ b/src/symbols/PhutilSymbolLoader.php
@@ -174,11 +174,12 @@
}
if ($this->type) {
- $types = array($this->type);
+ $types = (array)$this->type;
} else {
$types = array(
'class',
'function',
+ 'interface',
);
}
@@ -193,12 +194,6 @@
foreach ($libraries as $library) {
$map = $bootloader->getLibraryMap($library);
foreach ($types as $type) {
- if ($type == 'interface') {
- $lookup_map = $map['class'];
- } else {
- $lookup_map = $map[$type];
- }
-
// As an optimization, we filter the list of candidate symbols in
// several passes, applying a name-based filter first if possible since
// it is highly selective and guaranteed to match at most one symbol.
@@ -210,9 +205,9 @@
if ($this->name) {
// If we have a name filter, just pick the matching name out if it
// exists.
- if (isset($lookup_map[$this->name])) {
+ if (isset($map[$type][$this->name])) {
$filtered_map = array(
- $this->name => $lookup_map[$this->name],
+ $this->name => $map[$type][$this->name],
);
} else {
$filtered_map = array();
@@ -220,13 +215,13 @@
} else if ($names !== null) {
$filtered_map = array();
foreach ($names as $name => $ignored) {
- if (isset($lookup_map[$name])) {
- $filtered_map[$name] = $lookup_map[$name];
+ if (isset($map[$type][$name])) {
+ $filtered_map[$name] = $map[$type][$name];
}
}
} else {
// Otherwise, start with everything.
- $filtered_map = $lookup_map;
+ $filtered_map = $map[$type];
}
if ($this->pathPrefix) {
@@ -320,7 +315,7 @@
public function loadObjects(array $argv = array()) {
$symbols = $this
->setConcreteOnly(true)
- ->setType('class')
+ ->setType(array('class', 'interface'))
->selectAndLoadSymbols();
$objects = array();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Mar 21, 9:57 AM (3 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7707137
Default Alt Text
D13373.id32377.diff (6 KB)
Attached To
Mode
D13373: Separate interfaces in library maps
Attached
Detach File
Event Timeline
Log In to Comment