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

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

Issue 806933002: Issue 21883. Add checks if type parameters can be used. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years 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
Index: pkg/analysis_server/lib/src/services/correction/assist_internal.dart
diff --git a/pkg/analysis_server/lib/src/services/correction/assist_internal.dart b/pkg/analysis_server/lib/src/services/correction/assist_internal.dart
index 2fcc8c3d0150088383cac95dc870b6375185cd13..84eeeac1a476b25350b5bdecc42563b47b4c9f8d 100644
--- a/pkg/analysis_server/lib/src/services/correction/assist_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/assist_internal.dart
@@ -236,6 +236,7 @@ class AssistProcessor {
String typeSource;
DartType type = declaredIdentifier.identifier.bestType;
if (type is InterfaceType || type is FunctionType) {
+ _configureTargetLocation(node);
Set<LibraryElement> librariesToImport = new Set<LibraryElement>();
typeSource = utils.getTypeSource(type, librariesToImport);
_addLibraryImports(librariesToImport);
@@ -290,6 +291,7 @@ class AssistProcessor {
// prepare type source
String typeSource;
if (type is InterfaceType || type is FunctionType) {
+ _configureTargetLocation(node);
Set<LibraryElement> librariesToImport = new Set<LibraryElement>();
typeSource = utils.getTypeSource(type, librariesToImport);
_addLibraryImports(librariesToImport);
@@ -1623,6 +1625,20 @@ class AssistProcessor {
}
/**
+ * Configures [utils] using given [target].
+ */
+ void _configureTargetLocation(Object target) {
+ utils.targetClassElement = null;
+ if (target is AstNode) {
+ ClassDeclaration targetClassDeclaration =
+ target.getAncestor((node) => node is ClassDeclaration);
+ if (targetClassDeclaration != null) {
+ utils.targetClassElement = targetClassDeclaration.element;
+ }
+ }
+ }
+
+ /**
* Returns an existing or just added [LinkedEditGroup] with [groupId].
*/
LinkedEditGroup _getLinkedPosition(String groupId) {

Powered by Google App Engine
This is Rietveld 408576698