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

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

Issue 562293002: Issue 20891. Produce Quick Fixes for annotations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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 1cb09d539e7bcd222c1fc5573109c398d67c2802..e8e3350b2a77c2aa5241262e3186491610ed5c7a 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
@@ -102,6 +102,22 @@ class FixProcessor {
CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE) {
_addFix_replaceWithConstInstanceCreation();
}
+ if (errorCode == CompileTimeErrorCode.INVALID_ANNOTATION) {
+ if (node is Annotation) {
+ Annotation annotation = node;
+ Identifier name = annotation.name;
+ if (name != null && name.staticElement == null) {
+ node = name;
+ if (annotation.arguments == null) {
+ _addFix_importLibrary_withTopLevelVariable();
+ } else {
+ _addFix_importLibrary_withType();
+ _addFix_createClass();
+ _addFix_undefinedClass_useSimilar();
+ }
+ }
+ }
+ }
if (errorCode ==
CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT) {
_addFix_createConstructorSuperExplicit();
@@ -1831,6 +1847,9 @@ class FixProcessor {
static bool _mayBeTypeIdentifier(AstNode node) {
if (node is SimpleIdentifier) {
AstNode parent = node.parent;
+ if (parent is Annotation) {
+ return true;
+ }
if (parent is TypeName) {
return true;
}
« 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