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

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

Issue 2957203002: Index subtypes with supertypes, and names of members they declare. (Closed)
Patch Set: Created 3 years, 6 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 | « pkg/analyzer/lib/src/summary/idl.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/index_test.dart
diff --git a/pkg/analyzer/test/src/dart/analysis/index_test.dart b/pkg/analyzer/test/src/dart/analysis/index_test.dart
index ffa365d1f01d709c9d3ee3e7538090bbf6e0ae20..ec41c946ad5434159cc1d45f71201aa15f50bfcb 100644
--- a/pkg/analyzer/test/src/dart/analysis/index_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/index_test.dart
@@ -916,6 +916,59 @@ class A {
..isWrittenAt('field = 5', true);
}
+ test_subtypes() async {
+ String libP = 'package:test/lib.dart;package:test/lib.dart';
+ provider.newFile(
+ _p('$testProject/lib.dart'),
+ '''
+class A {}
+class B {}
+class C {}
+class D {}
+class E {}
+''');
+ await _indexTestUnit('''
+import 'lib.dart';
+
+class X extends A {
+ int field1, field2;
+ int get getter1 => null;
+ void set setter1(_) {}
+ void method1() {}
+}
+
+class Y extends Object with B, C {
+ void methodY() {}
+}
+
+class Z implements E, D {
+ void methodZ() {}
+}
+''');
+
+ {
+ AnalysisDriverSubtype X =
+ index.subtypes.singleWhere((t) => t.name == 'X');
+ expect(X.supertypes, ['$libP;A']);
+ expect(X.members, ['field1', 'field2', 'getter1', 'method1', 'setter1']);
+ }
+
+ {
+ AnalysisDriverSubtype Y =
+ index.subtypes.singleWhere((t) => t.name == 'Y');
+ expect(
+ Y.supertypes, ['dart:core;dart:core;Object', '$libP;B', '$libP;C']);
+ expect(Y.members, ['methodY']);
+ }
+
+ {
+ AnalysisDriverSubtype Z =
+ index.subtypes.singleWhere((t) => t.name == 'Z');
+ expect(Z.supertypes, ['$libP;D', '$libP;E']);
+ expect(Z.members, ['methodZ']);
+ }
+ }
+
test_usedName_inLibraryIdentifier() async {
await _indexTestUnit('''
library aaa.bbb.ccc;
« no previous file with comments | « pkg/analyzer/lib/src/summary/idl.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698