Index: pkg/analyzer_cli/lib/src/analyzer_impl.dart |
diff --git a/pkg/analyzer_cli/lib/src/analyzer_impl.dart b/pkg/analyzer_cli/lib/src/analyzer_impl.dart |
index a4c18310f679203ceaae2e43861d8355ad1569bd..1aab902511411e5887b91b63c8e50269e056259a 100644 |
--- a/pkg/analyzer_cli/lib/src/analyzer_impl.dart |
+++ b/pkg/analyzer_cli/lib/src/analyzer_impl.dart |
@@ -81,11 +81,13 @@ class AnalyzerImpl { |
void addCompilationUnitSource( |
CompilationUnitElement unit, Set<CompilationUnitElement> units) { |
- if (unit == null || units.contains(unit)) { |
+ if (unit == null || !units.add(unit)) { |
return; |
} |
- units.add(unit); |
- sources.add(unit.source); |
+ Source source = unit.source; |
+ if (source != null) { |
+ sources.add(source); |
+ } |
} |
void addLibrarySources(LibraryElement library, Set<LibraryElement> libraries, |