Always include added files into the list of files to discover.

R=brianwilkerson@google.com

Change-Id: Ida9f306652f7b991303dc849bb21dc1d384fa6e3
Reviewed-on: https://dart-review.googlesource.com/57711
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
diff --git a/pkg/analyzer/lib/src/dart/analysis/driver.dart b/pkg/analyzer/lib/src/dart/analysis/driver.dart
index e4640fb..2d5fd79 100644
--- a/pkg/analyzer/lib/src/dart/analysis/driver.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart
@@ -2273,7 +2273,7 @@
   bool isCompleted = false;
 
   Iterator<Folder> folderIterator;
-  List<String> files;
+  List<String> files = [];
   int fileIndex = 0;
 
   _DiscoverAvailableFilesTask(this.driver);
@@ -2284,15 +2284,16 @@
    * task should continue to be run.
    */
   void perform() {
+    // Always discover added files.
+    files.addAll(driver.addedFiles);
+
     // Prepare the iterator of package/lib folders.
     if (folderIterator == null) {
       var packageMap = driver._sourceFactory.packageMap;
       if (packageMap != null) {
         folderIterator = packageMap.values.expand((f) => f).iterator;
-        files = <String>[];
       } else {
-        isCompleted = true;
-        return;
+        folderIterator = <Folder>[].iterator;
       }
     }
 
diff --git a/pkg/analyzer/lib/src/dart/analysis/search.dart b/pkg/analyzer/lib/src/dart/analysis/search.dart
index 1307034..5e8c22d 100644
--- a/pkg/analyzer/lib/src/dart/analysis/search.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/search.dart
@@ -138,9 +138,6 @@
       }
     }
 
-    for (String path in _driver.addedFiles) {
-      _driver.fsState.getFileForPath(path);
-    }
     await _driver.discoverAvailableFiles();
 
     try {