| 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 analysis_server.src.services.correction.fix; | 5 library analysis_server.src.services.correction.fix; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/plugin/edit/fix/fix_core.dart'; | 9 import 'package:analysis_server/plugin/edit/fix/fix_core.dart'; |
| 10 import 'package:analysis_server/src/plugin/server_plugin.dart'; | 10 import 'package:analysis_server/src/plugin/server_plugin.dart'; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 errorCode == ParserErrorCode.GETTER_WITH_PARAMETERS || | 98 errorCode == ParserErrorCode.GETTER_WITH_PARAMETERS || |
| 99 errorCode == ParserErrorCode.VAR_AS_TYPE_NAME || | 99 errorCode == ParserErrorCode.VAR_AS_TYPE_NAME || |
| 100 errorCode == StaticTypeWarningCode.ILLEGAL_ASYNC_RETURN_TYPE || | 100 errorCode == StaticTypeWarningCode.ILLEGAL_ASYNC_RETURN_TYPE || |
| 101 errorCode == StaticTypeWarningCode.INSTANCE_ACCESS_TO_STATIC_MEMBER || | 101 errorCode == StaticTypeWarningCode.INSTANCE_ACCESS_TO_STATIC_MEMBER || |
| 102 errorCode == StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION || | 102 errorCode == StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION || |
| 103 errorCode == StaticTypeWarningCode.NON_TYPE_AS_TYPE_ARGUMENT || | 103 errorCode == StaticTypeWarningCode.NON_TYPE_AS_TYPE_ARGUMENT || |
| 104 errorCode == StaticTypeWarningCode.UNDEFINED_FUNCTION || | 104 errorCode == StaticTypeWarningCode.UNDEFINED_FUNCTION || |
| 105 errorCode == StaticTypeWarningCode.UNDEFINED_GETTER || | 105 errorCode == StaticTypeWarningCode.UNDEFINED_GETTER || |
| 106 errorCode == StaticTypeWarningCode.UNDEFINED_METHOD || | 106 errorCode == StaticTypeWarningCode.UNDEFINED_METHOD || |
| 107 errorCode == StaticTypeWarningCode.UNDEFINED_SETTER || | 107 errorCode == StaticTypeWarningCode.UNDEFINED_SETTER || |
| 108 (errorCode is LintCode && errorCode.name == LintNames.annotate_overrides); | 108 (errorCode is LintCode && |
| 109 (errorCode.name == LintNames.annotate_overrides || |
| 110 errorCode.name == LintNames.unnecessary_brace_in_string_interp)); |
| 109 | 111 |
| 110 /** | 112 /** |
| 111 * An enumeration of possible quick fix kinds. | 113 * An enumeration of possible quick fix kinds. |
| 112 */ | 114 */ |
| 113 class DartFixKind { | 115 class DartFixKind { |
| 114 static const ADD_ASYNC = | 116 static const ADD_ASYNC = |
| 115 const FixKind('ADD_ASYNC', 50, "Add 'async' modifier"); | 117 const FixKind('ADD_ASYNC', 50, "Add 'async' modifier"); |
| 116 static const ADD_FIELD_FORMAL_PARAMETERS = const FixKind( | 118 static const ADD_FIELD_FORMAL_PARAMETERS = const FixKind( |
| 117 'ADD_FIELD_FORMAL_PARAMETERS', 30, "Add final field formal parameters"); | 119 'ADD_FIELD_FORMAL_PARAMETERS', 30, "Add final field formal parameters"); |
| 118 static const ADD_MISSING_PARAMETER_POSITIONAL = const FixKind( | 120 static const ADD_MISSING_PARAMETER_POSITIONAL = const FixKind( |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 static const IMPORT_LIBRARY_PROJECT3 = | 174 static const IMPORT_LIBRARY_PROJECT3 = |
| 173 const FixKind('IMPORT_LIBRARY_PROJECT3', 49, "Import library '{0}'"); | 175 const FixKind('IMPORT_LIBRARY_PROJECT3', 49, "Import library '{0}'"); |
| 174 static const IMPORT_LIBRARY_SDK = | 176 static const IMPORT_LIBRARY_SDK = |
| 175 const FixKind('IMPORT_LIBRARY_SDK', 49, "Import library '{0}'"); | 177 const FixKind('IMPORT_LIBRARY_SDK', 49, "Import library '{0}'"); |
| 176 static const IMPORT_LIBRARY_SHOW = | 178 static const IMPORT_LIBRARY_SHOW = |
| 177 const FixKind('IMPORT_LIBRARY_SHOW', 49, "Update library '{0}' import"); | 179 const FixKind('IMPORT_LIBRARY_SHOW', 49, "Update library '{0}' import"); |
| 178 static const INSERT_SEMICOLON = | 180 static const INSERT_SEMICOLON = |
| 179 const FixKind('INSERT_SEMICOLON', 50, "Insert ';'"); | 181 const FixKind('INSERT_SEMICOLON', 50, "Insert ';'"); |
| 180 static const LINT_ADD_OVERRIDE = | 182 static const LINT_ADD_OVERRIDE = |
| 181 const FixKind('LINT_ADD_OVERRIDE', 50, "Add '@override' annotation"); | 183 const FixKind('LINT_ADD_OVERRIDE', 50, "Add '@override' annotation"); |
| 184 static const LINT_REMOVE_INTERPOLATION_BRACES = const FixKind( |
| 185 'LINT_REMOVE_INTERPOLATION_BRACES', |
| 186 50, |
| 187 'Remove unnecessary interpolation braces'); |
| 182 static const MAKE_CLASS_ABSTRACT = | 188 static const MAKE_CLASS_ABSTRACT = |
| 183 const FixKind('MAKE_CLASS_ABSTRACT', 50, "Make class '{0}' abstract"); | 189 const FixKind('MAKE_CLASS_ABSTRACT', 50, "Make class '{0}' abstract"); |
| 184 static const REMOVE_DEAD_CODE = | 190 static const REMOVE_DEAD_CODE = |
| 185 const FixKind('REMOVE_DEAD_CODE', 50, "Remove dead code"); | 191 const FixKind('REMOVE_DEAD_CODE', 50, "Remove dead code"); |
| 186 static const MAKE_FIELD_NOT_FINAL = | 192 static const MAKE_FIELD_NOT_FINAL = |
| 187 const FixKind('MAKE_FIELD_NOT_FINAL', 50, "Make field '{0}' not final"); | 193 const FixKind('MAKE_FIELD_NOT_FINAL', 50, "Make field '{0}' not final"); |
| 188 static const REMOVE_PARAMETERS_IN_GETTER_DECLARATION = const FixKind( | 194 static const REMOVE_PARAMETERS_IN_GETTER_DECLARATION = const FixKind( |
| 189 'REMOVE_PARAMETERS_IN_GETTER_DECLARATION', | 195 'REMOVE_PARAMETERS_IN_GETTER_DECLARATION', |
| 190 50, | 196 50, |
| 191 "Remove parameters in getter declaration"); | 197 "Remove parameters in getter declaration"); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 @override | 245 @override |
| 240 final AnalysisError error; | 246 final AnalysisError error; |
| 241 | 247 |
| 242 FixContextImpl(this.resourceProvider, this.analysisContext, this.error); | 248 FixContextImpl(this.resourceProvider, this.analysisContext, this.error); |
| 243 | 249 |
| 244 FixContextImpl.from(FixContext other) | 250 FixContextImpl.from(FixContext other) |
| 245 : resourceProvider = other.resourceProvider, | 251 : resourceProvider = other.resourceProvider, |
| 246 analysisContext = other.analysisContext, | 252 analysisContext = other.analysisContext, |
| 247 error = other.error; | 253 error = other.error; |
| 248 } | 254 } |
| OLD | NEW |