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

Unified Diff: pkg/analyzer/test/src/dart/analysis/driver_test.dart

Issue 2524733006: Compute files referencing an externally defined name. (Closed)
Patch Set: Created 4 years, 1 month 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 | « pkg/analyzer/lib/src/dart/analysis/driver.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/src/dart/analysis/driver_test.dart
diff --git a/pkg/analyzer/test/src/dart/analysis/driver_test.dart b/pkg/analyzer/test/src/dart/analysis/driver_test.dart
index f4ee85b3e9c1f81207097a0e46adb35590ee73c9..1fd629ba574b24cf2b5b2a64f49a0f37ae1bc938 100644
--- a/pkg/analyzer/test/src/dart/analysis/driver_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/driver_test.dart
@@ -400,6 +400,37 @@ var A2 = B1;
expect(allResults, [result]);
}
+ test_getFilesReferencingName() async {
+ var a = _p('/test/bin/a.dart');
+ var b = _p('/test/bin/b.dart');
+ var c = _p('/test/bin/c.dart');
+ var d = _p('/test/bin/d.dart');
+ var e = _p('/test/bin/e.dart');
+
+ provider.newFile(a, 'class A {}');
+ provider.newFile(b, "import 'a.dart'; A a;");
+ provider.newFile(c, "import 'a.dart'; var a = new A();");
+ provider.newFile(d, "classs A{} A a;");
+ provider.newFile(e, "import 'a.dart'; main() {}");
+
+ driver.addFile(a);
+ driver.addFile(b);
+ driver.addFile(c);
+ driver.addFile(d);
+ driver.addFile(e);
+
+ // 'b.dart' references an external 'A'.
+ // 'c.dart' references an external 'A'.
+ // 'd.dart' references the local 'A'.
+ // 'e.dart' does not reference 'A' at all.
+ List<String> files = await driver.getFilesReferencingName('A');
+ expect(files, unorderedEquals([b, c]));
+
+ // We get the same results second time.
+ List<String> files2 = await driver.getFilesReferencingName('A');
+ expect(files2, unorderedEquals([b, c]));
+ }
+
test_getResult_constants_defaultParameterValue_localFunction() async {
var a = _p('/test/bin/a.dart');
var b = _p('/test/bin/b.dart');
« no previous file with comments | « pkg/analyzer/lib/src/dart/analysis/driver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698