| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 import 'package:analyzer/src/summary/format.dart'; | 5 import 'package:analyzer/src/summary/format.dart'; |
| 6 import 'package:analyzer/src/summary/name_filter.dart'; | 6 import 'package:analyzer/src/summary/name_filter.dart'; |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * Create a [PrelinkedLibraryBuilder] corresponding to the given | 9 * Create a [PrelinkedLibraryBuilder] corresponding to the given |
| 10 * [definingUnit], which should be the defining compilation unit for a library. | 10 * [definingUnit], which should be the defining compilation unit for a library. |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 * [definingUnit] via [relativeUri], by aggregating together public namespace | 149 * [definingUnit] via [relativeUri], by aggregating together public namespace |
| 150 * information from all of its parts. | 150 * information from all of its parts. |
| 151 */ | 151 */ |
| 152 Map<String, _Meaning> aggregatePublicNamespace(String relativeUri) { | 152 Map<String, _Meaning> aggregatePublicNamespace(String relativeUri) { |
| 153 if (uriToDependency.containsKey(relativeUri)) { | 153 if (uriToDependency.containsKey(relativeUri)) { |
| 154 return dependencyToPublicNamespace[uriToDependency[relativeUri]]; | 154 return dependencyToPublicNamespace[uriToDependency[relativeUri]]; |
| 155 } | 155 } |
| 156 assert(dependencies.length == dependencyToPublicNamespace.length); | 156 assert(dependencies.length == dependencyToPublicNamespace.length); |
| 157 int dependency = dependencies.length; | 157 int dependency = dependencies.length; |
| 158 uriToDependency[relativeUri] = dependency; | 158 uriToDependency[relativeUri] = dependency; |
| 159 dependencies.add(encodePrelinkedDependency(uri: relativeUri)); | 159 List<String> unitUris = getUnitUris(relativeUri); |
| 160 PrelinkedDependencyBuilder prelinkedDependency = |
| 161 encodePrelinkedDependency(uri: relativeUri, parts: unitUris.sublist(1)); |
| 162 dependencies.add(prelinkedDependency); |
| 160 | 163 |
| 161 Map<String, _Meaning> aggregated = <String, _Meaning>{}; | 164 Map<String, _Meaning> aggregated = <String, _Meaning>{}; |
| 162 | 165 |
| 163 List<String> unitUris = getUnitUris(relativeUri); | |
| 164 for (int unitNum = 0; unitNum < unitUris.length; unitNum++) { | 166 for (int unitNum = 0; unitNum < unitUris.length; unitNum++) { |
| 165 String unitUri = unitUris[unitNum]; | 167 String unitUri = unitUris[unitNum]; |
| 166 UnlinkedPublicNamespace importedNamespace = getImportCached(unitUri); | 168 UnlinkedPublicNamespace importedNamespace = getImportCached(unitUri); |
| 167 if (importedNamespace == null) { | 169 if (importedNamespace == null) { |
| 168 continue; | 170 continue; |
| 169 } | 171 } |
| 170 for (UnlinkedPublicName name in importedNamespace.names) { | 172 for (UnlinkedPublicName name in importedNamespace.names) { |
| 171 aggregated.putIfAbsent( | 173 aggregated.putIfAbsent( |
| 172 name.name, | 174 name.name, |
| 173 () => new _Meaning( | 175 () => new _Meaning( |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 * [sourceUri] is also relative. | 409 * [sourceUri] is also relative. |
| 408 */ | 410 */ |
| 409 String resolveUri(String sourceUri, String relativeUri) { | 411 String resolveUri(String sourceUri, String relativeUri) { |
| 410 if (sourceUri == null) { | 412 if (sourceUri == null) { |
| 411 return relativeUri; | 413 return relativeUri; |
| 412 } else { | 414 } else { |
| 413 return Uri.parse(sourceUri).resolve(relativeUri).toString(); | 415 return Uri.parse(sourceUri).resolve(relativeUri).toString(); |
| 414 } | 416 } |
| 415 } | 417 } |
| 416 } | 418 } |
| OLD | NEW |