Pass Source to parseText() in summary tests.

Change-Id: Ic038c217aba32e2548a02735154c70a56ef900e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220881
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
diff --git a/pkg/analyzer/test/src/summary/resynthesize_ast2_test.dart b/pkg/analyzer/test/src/summary/resynthesize_ast2_test.dart
index e045770..6378283 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_ast2_test.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_ast2_test.dart
@@ -62,7 +62,7 @@
     for (var sdkLibrary in sdk.sdkLibraries) {
       var source = sourceFactory.resolveUri(null, sdkLibrary.shortName)!;
       var text = getFile(source.fullName).readAsStringSync();
-      var unit = parseText(text, featureSet);
+      var unit = parseText(source, text, featureSet);
 
       var inputUnits = <LinkInputUnit>[];
       _addLibraryUnits(source, unit, inputUnits, featureSet);
@@ -180,7 +180,7 @@
 
         if (partSource != null) {
           var text = _readSafely(partSource.fullName);
-          var unit = parseText(text, featureSet);
+          var unit = parseText(partSource, text, featureSet);
           units.add(
             LinkInputUnit(
               partDirectiveIndex: partDirectiveIndex,
@@ -205,7 +205,7 @@
     }
 
     var text = _readSafely(source.fullName);
-    var unit = parseText(text, featureSet);
+    var unit = parseText(source, text, featureSet);
 
     var units = <LinkInputUnit>[];
     _addLibraryUnits(source, unit, units, featureSet);
diff --git a/pkg/analyzer/test/src/summary/test_strategies.dart b/pkg/analyzer/test/src/summary/test_strategies.dart
index 5632a0a..8d21be1 100644
--- a/pkg/analyzer/test/src/summary/test_strategies.dart
+++ b/pkg/analyzer/test/src/summary/test_strategies.dart
@@ -14,22 +14,22 @@
 import 'package:analyzer/src/generated/source.dart';
 
 CompilationUnit parseText(
+  Source source,
   String text,
   FeatureSet featureSet,
 ) {
   CharSequenceReader reader = CharSequenceReader(text);
-  Scanner scanner =
-      Scanner(_SourceMock.instance, reader, AnalysisErrorListener.NULL_LISTENER)
-        ..configureFeatures(
-          featureSetForOverriding: featureSet,
-          featureSet: featureSet,
-        );
+  Scanner scanner = Scanner(source, reader, AnalysisErrorListener.NULL_LISTENER)
+    ..configureFeatures(
+      featureSetForOverriding: featureSet,
+      featureSet: featureSet,
+    );
   Token token = scanner.tokenize();
   // Pass the feature set from the scanner to the parser
   // because the scanner may have detected a language version comment
   // and downgraded the feature set it holds.
   Parser parser = Parser(
-    NonExistingSource.unknown,
+    source,
     AnalysisErrorListener.NULL_LISTENER,
     featureSet: scanner.featureSet,
   );
@@ -43,10 +43,3 @@
 
   return unit;
 }
-
-class _SourceMock implements Source {
-  static final Source instance = _SourceMock();
-
-  @override
-  noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
-}