Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(412)

Unified Diff: pkg/analysis_server/lib/src/services/completion/imported_computer.dart

Issue 565793002: fix code completion import dart exception (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/completion/imported_computer_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/services/completion/imported_computer.dart
diff --git a/pkg/analysis_server/lib/src/services/completion/imported_computer.dart b/pkg/analysis_server/lib/src/services/completion/imported_computer.dart
index 67bd01f1f13d675a71f8cae6173271a96c0b7751..a8f5ab4bb8359ff3c49fdb49f6b29cdccc8a1635 100644
--- a/pkg/analysis_server/lib/src/services/completion/imported_computer.dart
+++ b/pkg/analysis_server/lib/src/services/completion/imported_computer.dart
@@ -109,20 +109,23 @@ class _ImportedVisitor extends GeneralizingAstVisitor<Future<bool>> {
// and the list of names that should be shown or hidden
request.unit.directives.forEach((Directive directive) {
if (directive is ImportDirective) {
- LibraryElement lib = directive.element.importedLibrary;
- if (directive.prefix == null) {
- visibleLibs.add(lib);
- directive.combinators.forEach((Combinator combinator) {
- if (combinator is ShowCombinator) {
- showNames[lib] =
- combinator.shownNames.map((SimpleIdentifier id) => id.name).toSet();
- } else if (combinator is HideCombinator) {
- hideNames[lib] =
- combinator.hiddenNames.map((SimpleIdentifier id) => id.name).toSet();
- }
- });
- } else {
- excludedLibs.add(lib);
+ ImportElement element = directive.element;
+ if (element != null) {
+ LibraryElement lib = element.importedLibrary;
+ if (directive.prefix == null) {
+ visibleLibs.add(lib);
+ directive.combinators.forEach((Combinator combinator) {
+ if (combinator is ShowCombinator) {
+ showNames[lib] =
+ combinator.shownNames.map((SimpleIdentifier id) => id.name).toSet();
+ } else if (combinator is HideCombinator) {
+ hideNames[lib] =
+ combinator.hiddenNames.map((SimpleIdentifier id) => id.name).toSet();
+ }
+ });
+ } else {
+ excludedLibs.add(lib);
+ }
}
}
});
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/completion/imported_computer_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698