| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library services.correction.fix; | 5 library services.correction.fix; |
| 6 | 6 |
| 7 import 'package:analysis_services/correction/change.dart'; | 7 import 'package:analysis_services/correction/change.dart'; |
| 8 import 'package:analysis_services/search/search_engine.dart'; | 8 import 'package:analysis_services/search/search_engine.dart'; |
| 9 import 'package:analysis_services/src/correction/fix.dart'; | 9 import 'package:analysis_services/src/correction/fix.dart'; |
| 10 import 'package:analyzer/src/generated/ast.dart'; | 10 import 'package:analyzer/src/generated/ast.dart'; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 return '[kind=$kind, change=$change]'; | 40 return '[kind=$kind, change=$change]'; |
| 41 } | 41 } |
| 42 } | 42 } |
| 43 | 43 |
| 44 | 44 |
| 45 /** | 45 /** |
| 46 * An enumeration of possible quick fix kinds. | 46 * An enumeration of possible quick fix kinds. |
| 47 */ | 47 */ |
| 48 class FixKind { | 48 class FixKind { |
| 49 static const ADD_PACKAGE_DEPENDENCY = | 49 static const ADD_PACKAGE_DEPENDENCY = |
| 50 const FixKind('ADD_PACKAGE_DEPENDENCY', 50, "Add dependency on package '%s
'"); | 50 const FixKind('ADD_PACKAGE_DEPENDENCY', 50, "Add dependency on package '{0
}'"); |
| 51 static const ADD_SUPER_CONSTRUCTOR_INVOCATION = | 51 static const ADD_SUPER_CONSTRUCTOR_INVOCATION = |
| 52 const FixKind( | 52 const FixKind( |
| 53 'ADD_SUPER_CONSTRUCTOR_INVOCATION', | 53 'ADD_SUPER_CONSTRUCTOR_INVOCATION', |
| 54 50, | 54 50, |
| 55 "Add super constructor %s invocation"); | 55 "Add super constructor {0} invocation"); |
| 56 static const CHANGE_TO = const FixKind('CHANGE_TO', 51, "Change to '%s'"); | 56 static const CHANGE_TO = const FixKind('CHANGE_TO', 51, "Change to '{0}'"); |
| 57 static const CHANGE_TO_STATIC_ACCESS = | 57 static const CHANGE_TO_STATIC_ACCESS = |
| 58 const FixKind( | 58 const FixKind( |
| 59 'CHANGE_TO_STATIC_ACCESS', | 59 'CHANGE_TO_STATIC_ACCESS', |
| 60 50, | 60 50, |
| 61 "Change access to static using '%s'"); | 61 "Change access to static using '{0}'"); |
| 62 static const CREATE_CLASS = | 62 static const CREATE_CLASS = |
| 63 const FixKind('CREATE_CLASS', 50, "Create class '%s'"); | 63 const FixKind('CREATE_CLASS', 50, "Create class '{0}'"); |
| 64 static const CREATE_CONSTRUCTOR = | 64 static const CREATE_CONSTRUCTOR = |
| 65 const FixKind('CREATE_CONSTRUCTOR', 50, "Create constructor '%s'"); | 65 const FixKind('CREATE_CONSTRUCTOR', 50, "Create constructor '{0}'"); |
| 66 static const CREATE_CONSTRUCTOR_SUPER = | 66 static const CREATE_CONSTRUCTOR_SUPER = |
| 67 const FixKind('CREATE_CONSTRUCTOR_SUPER', 50, "Create constructor to call
%s"); | 67 const FixKind('CREATE_CONSTRUCTOR_SUPER', 50, "Create constructor to call
{0}"); |
| 68 static const CREATE_FUNCTION = | 68 static const CREATE_FUNCTION = |
| 69 const FixKind('CREATE_FUNCTION', 49, "Create function '%s'"); | 69 const FixKind('CREATE_FUNCTION', 49, "Create function '{0}'"); |
| 70 static const CREATE_METHOD = | 70 static const CREATE_METHOD = |
| 71 const FixKind('CREATE_METHOD', 50, "Create method '%s'"); | 71 const FixKind('CREATE_METHOD', 50, "Create method '{0}'"); |
| 72 static const CREATE_MISSING_OVERRIDES = | 72 static const CREATE_MISSING_OVERRIDES = |
| 73 const FixKind('CREATE_MISSING_OVERRIDES', 50, "Create %d missing override(
s)"); | 73 const FixKind('CREATE_MISSING_OVERRIDES', 50, "Create %d missing override(
s)"); |
| 74 static const CREATE_NO_SUCH_METHOD = | 74 static const CREATE_NO_SUCH_METHOD = |
| 75 const FixKind('CREATE_NO_SUCH_METHOD', 49, "Create 'noSuchMethod' method")
; | 75 const FixKind('CREATE_NO_SUCH_METHOD', 49, "Create 'noSuchMethod' method")
; |
| 76 static const CREATE_PART = | 76 static const CREATE_PART = |
| 77 const FixKind('CREATE_PART', 50, "Create part '%s'"); | 77 const FixKind('CREATE_PART', 50, "Create part '{0}'"); |
| 78 static const IMPORT_LIBRARY_PREFIX = | 78 static const IMPORT_LIBRARY_PREFIX = |
| 79 const FixKind( | 79 const FixKind( |
| 80 'IMPORT_LIBRARY_PREFIX', | 80 'IMPORT_LIBRARY_PREFIX', |
| 81 51, | 81 51, |
| 82 "Use imported library '%s' with prefix '%s'"); | 82 "Use imported library '{0}' with prefix '{1}'"); |
| 83 static const IMPORT_LIBRARY_PROJECT = | 83 static const IMPORT_LIBRARY_PROJECT = |
| 84 const FixKind('IMPORT_LIBRARY_PROJECT', 51, "Import library '%s'"); | 84 const FixKind('IMPORT_LIBRARY_PROJECT', 51, "Import library '{0}'"); |
| 85 static const IMPORT_LIBRARY_SDK = | 85 static const IMPORT_LIBRARY_SDK = |
| 86 const FixKind('IMPORT_LIBRARY_SDK', 51, "Import library '%s'"); | 86 const FixKind('IMPORT_LIBRARY_SDK', 51, "Import library '{0}'"); |
| 87 static const IMPORT_LIBRARY_SHOW = | 87 static const IMPORT_LIBRARY_SHOW = |
| 88 const FixKind('IMPORT_LIBRARY_SHOW', 51, "Update library '%s' import"); | 88 const FixKind('IMPORT_LIBRARY_SHOW', 51, "Update library '{0}' import"); |
| 89 static const INSERT_SEMICOLON = | 89 static const INSERT_SEMICOLON = |
| 90 const FixKind('INSERT_SEMICOLON', 50, "Insert ';'"); | 90 const FixKind('INSERT_SEMICOLON', 50, "Insert ';'"); |
| 91 static const MAKE_CLASS_ABSTRACT = | 91 static const MAKE_CLASS_ABSTRACT = |
| 92 const FixKind('MAKE_CLASS_ABSTRACT', 50, "Make class '%s' abstract"); | 92 const FixKind('MAKE_CLASS_ABSTRACT', 50, "Make class '{0}' abstract"); |
| 93 static const REMOVE_PARAMETERS_IN_GETTER_DECLARATION = | 93 static const REMOVE_PARAMETERS_IN_GETTER_DECLARATION = |
| 94 const FixKind( | 94 const FixKind( |
| 95 'REMOVE_PARAMETERS_IN_GETTER_DECLARATION', | 95 'REMOVE_PARAMETERS_IN_GETTER_DECLARATION', |
| 96 50, | 96 50, |
| 97 "Remove parameters in getter declaration"); | 97 "Remove parameters in getter declaration"); |
| 98 static const REMOVE_PARENTHESIS_IN_GETTER_INVOCATION = | 98 static const REMOVE_PARENTHESIS_IN_GETTER_INVOCATION = |
| 99 const FixKind( | 99 const FixKind( |
| 100 'REMOVE_PARENTHESIS_IN_GETTER_INVOCATION', | 100 'REMOVE_PARENTHESIS_IN_GETTER_INVOCATION', |
| 101 50, | 101 50, |
| 102 "Remove parentheses in getter invocation"); | 102 "Remove parentheses in getter invocation"); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 119 | 119 |
| 120 final name; | 120 final name; |
| 121 final int relevance; | 121 final int relevance; |
| 122 final String message; | 122 final String message; |
| 123 | 123 |
| 124 const FixKind(this.name, this.relevance, this.message); | 124 const FixKind(this.name, this.relevance, this.message); |
| 125 | 125 |
| 126 @override | 126 @override |
| 127 String toString() => name; | 127 String toString() => name; |
| 128 } | 128 } |
| OLD | NEW |