| 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/generated/utilities_dart.dart'; | 5 import 'package:analyzer/src/generated/utilities_dart.dart'; |
| 6 import 'package:analyzer/src/summary/format.dart'; | 6 import 'package:analyzer/src/summary/format.dart'; |
| 7 import 'package:analyzer/src/summary/idl.dart'; | 7 import 'package:analyzer/src/summary/idl.dart'; |
| 8 import 'package:analyzer/src/summary/name_filter.dart'; | 8 import 'package:analyzer/src/summary/name_filter.dart'; |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 | 344 |
| 345 /** | 345 /** |
| 346 * Filter the export namespace for the library whose URI is reachable from | 346 * Filter the export namespace for the library whose URI is reachable from |
| 347 * [definingUnit] via [relativeUri], retaining only those names accepted by | 347 * [definingUnit] via [relativeUri], retaining only those names accepted by |
| 348 * [combinators], and store the resulting names in [result]. Names that | 348 * [combinators], and store the resulting names in [result]. Names that |
| 349 * already exist in [result] are not overwritten. | 349 * already exist in [result] are not overwritten. |
| 350 */ | 350 */ |
| 351 void filterExportNamespace(String relativeUri, | 351 void filterExportNamespace(String relativeUri, |
| 352 List<UnlinkedCombinator> combinators, Map<String, _Meaning> result) { | 352 List<UnlinkedCombinator> combinators, Map<String, _Meaning> result) { |
| 353 Map<String, _Meaning> exportNamespace = computeExportNamespace(relativeUri); | 353 Map<String, _Meaning> exportNamespace = computeExportNamespace(relativeUri); |
| 354 if (result == null) { |
| 355 // This can happen if the import prefix was shadowed by a local name, so |
| 356 // the imported symbols are inaccessible. |
| 357 return; |
| 358 } |
| 354 NameFilter filter = new NameFilter.forUnlinkedCombinators(combinators); | 359 NameFilter filter = new NameFilter.forUnlinkedCombinators(combinators); |
| 355 exportNamespace.forEach((String name, _Meaning meaning) { | 360 exportNamespace.forEach((String name, _Meaning meaning) { |
| 356 if (filter.accepts(name) && !result.containsKey(name)) { | 361 if (filter.accepts(name) && !result.containsKey(name)) { |
| 357 result[name] = meaning; | 362 result[name] = meaning; |
| 358 } | 363 } |
| 359 }); | 364 }); |
| 360 } | 365 } |
| 361 | 366 |
| 362 /** | 367 /** |
| 363 * Wrapper around [getImport] that caches the return value in [importCache]. | 368 * Wrapper around [getImport] that caches the return value in [importCache]. |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 String _selectUri( | 540 String _selectUri( |
| 536 String defaultUri, List<UnlinkedConfiguration> configurations) { | 541 String defaultUri, List<UnlinkedConfiguration> configurations) { |
| 537 for (UnlinkedConfiguration configuration in configurations) { | 542 for (UnlinkedConfiguration configuration in configurations) { |
| 538 if (getDeclaredVariable(configuration.name) == configuration.value) { | 543 if (getDeclaredVariable(configuration.name) == configuration.value) { |
| 539 return configuration.uri; | 544 return configuration.uri; |
| 540 } | 545 } |
| 541 } | 546 } |
| 542 return defaultUri; | 547 return defaultUri; |
| 543 } | 548 } |
| 544 } | 549 } |
| OLD | NEW |