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

Unified Diff: pkg/analysis_server/lib/src/services/correction/fix_internal.dart

Issue 1661763002: WEB-20151. Include type arguments into type proposals. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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 | « no previous file | pkg/analysis_server/test/services/correction/fix_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/services/correction/fix_internal.dart
diff --git a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
index c04bd7569d6887b913c1f023c83ff1687dce53f7..948d8e3e9a6cc28d1ab23f2067e7a02aeda65a28 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
@@ -2238,7 +2238,7 @@ class FixProcessor {
{
sb.startPosition('TYPE$i');
sb.append(typeSource);
- _addSuperTypeProposals(sb, new Set(), type);
+ _addSuperTypeProposals(sb, type);
sb.endPosition();
}
sb.append(' ');
@@ -2340,7 +2340,7 @@ class FixProcessor {
if (typeSource != 'dynamic') {
sb.startPosition('TYPE$index');
sb.append(typeSource);
- _addSuperTypeProposals(sb, new Set(), type);
+ _addSuperTypeProposals(sb, type);
sb.endPosition();
sb.append(' ');
}
@@ -2821,16 +2821,14 @@ class FixProcessor {
}
}
- static void _addSuperTypeProposals(
- SourceBuilder sb, Set<DartType> alreadyAdded, DartType type) {
- if (type != null &&
- type.element is ClassElement &&
- alreadyAdded.add(type)) {
- ClassElement element = type.element as ClassElement;
- sb.addSuggestion(LinkedEditSuggestionKind.TYPE, element.name);
- _addSuperTypeProposals(sb, alreadyAdded, element.supertype);
- for (InterfaceType interfaceType in element.interfaces) {
- _addSuperTypeProposals(sb, alreadyAdded, interfaceType);
+ static void _addSuperTypeProposals(SourceBuilder sb, DartType type,
+ [Set<DartType> alreadyAdded]) {
+ alreadyAdded ??= new Set<DartType>();
+ if (type is InterfaceType && alreadyAdded.add(type)) {
+ sb.addSuggestion(LinkedEditSuggestionKind.TYPE, type.displayName);
+ _addSuperTypeProposals(sb, type.superclass, alreadyAdded);
+ for (InterfaceType interfaceType in type.interfaces) {
+ _addSuperTypeProposals(sb, interfaceType, alreadyAdded);
}
}
}
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/correction/fix_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698