| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 errorCode == StaticTypeWarningCode.INSTANCE_ACCESS_TO_STATIC_MEMBER || | 102 errorCode == StaticTypeWarningCode.INSTANCE_ACCESS_TO_STATIC_MEMBER || |
| 103 errorCode == StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION || | 103 errorCode == StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION || |
| 104 errorCode == StaticTypeWarningCode.NON_TYPE_AS_TYPE_ARGUMENT || | 104 errorCode == StaticTypeWarningCode.NON_TYPE_AS_TYPE_ARGUMENT || |
| 105 errorCode == StaticTypeWarningCode.UNDEFINED_FUNCTION || | 105 errorCode == StaticTypeWarningCode.UNDEFINED_FUNCTION || |
| 106 errorCode == StaticTypeWarningCode.UNDEFINED_GETTER || | 106 errorCode == StaticTypeWarningCode.UNDEFINED_GETTER || |
| 107 errorCode == StaticTypeWarningCode.UNDEFINED_METHOD || | 107 errorCode == StaticTypeWarningCode.UNDEFINED_METHOD || |
| 108 errorCode == StaticTypeWarningCode.UNDEFINED_SETTER || | 108 errorCode == StaticTypeWarningCode.UNDEFINED_SETTER || |
| 109 errorCode == CompileTimeErrorCode.UNDEFINED_NAMED_PARAMETER || | 109 errorCode == CompileTimeErrorCode.UNDEFINED_NAMED_PARAMETER || |
| 110 (errorCode is LintCode && | 110 (errorCode is LintCode && |
| 111 (errorCode.name == LintNames.annotate_overrides || | 111 (errorCode.name == LintNames.annotate_overrides || |
| 112 errorCode.name == LintNames.avoid_init_to_null || | 112 errorCode.name == LintNames.unnecessary_brace_in_string_interp || |
| 113 errorCode.name == LintNames.prefer_collection_literals || | 113 errorCode.name == LintNames.avoid_init_to_null)); |
| 114 errorCode.name == LintNames.unnecessary_brace_in_string_interp)); | |
| 115 | 114 |
| 116 /** | 115 /** |
| 117 * An enumeration of possible quick fix kinds. | 116 * An enumeration of possible quick fix kinds. |
| 118 */ | 117 */ |
| 119 class DartFixKind { | 118 class DartFixKind { |
| 120 static const ADD_ASYNC = | 119 static const ADD_ASYNC = |
| 121 const FixKind('ADD_ASYNC', 50, "Add 'async' modifier"); | 120 const FixKind('ADD_ASYNC', 50, "Add 'async' modifier"); |
| 122 static const ADD_FIELD_FORMAL_PARAMETERS = const FixKind( | 121 static const ADD_FIELD_FORMAL_PARAMETERS = const FixKind( |
| 123 'ADD_FIELD_FORMAL_PARAMETERS', 30, "Add final field formal parameters"); | 122 'ADD_FIELD_FORMAL_PARAMETERS', 30, "Add final field formal parameters"); |
| 124 static const ADD_MISSING_PARAMETER_POSITIONAL = const FixKind( | 123 static const ADD_MISSING_PARAMETER_POSITIONAL = const FixKind( |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 static const REMOVE_UNUSED_IMPORT = | 215 static const REMOVE_UNUSED_IMPORT = |
| 217 const FixKind('REMOVE_UNUSED_IMPORT', 50, "Remove unused import"); | 216 const FixKind('REMOVE_UNUSED_IMPORT', 50, "Remove unused import"); |
| 218 static const REPLACE_BOOLEAN_WITH_BOOL = const FixKind( | 217 static const REPLACE_BOOLEAN_WITH_BOOL = const FixKind( |
| 219 'REPLACE_BOOLEAN_WITH_BOOL', 50, "Replace 'boolean' with 'bool'"); | 218 'REPLACE_BOOLEAN_WITH_BOOL', 50, "Replace 'boolean' with 'bool'"); |
| 220 static const REPLACE_VAR_WITH_DYNAMIC = const FixKind( | 219 static const REPLACE_VAR_WITH_DYNAMIC = const FixKind( |
| 221 'REPLACE_VAR_WITH_DYNAMIC', 50, "Replace 'var' with 'dynamic'"); | 220 'REPLACE_VAR_WITH_DYNAMIC', 50, "Replace 'var' with 'dynamic'"); |
| 222 static const REPLACE_RETURN_TYPE_FUTURE = const FixKind( | 221 static const REPLACE_RETURN_TYPE_FUTURE = const FixKind( |
| 223 'REPLACE_RETURN_TYPE_FUTURE', | 222 'REPLACE_RETURN_TYPE_FUTURE', |
| 224 50, | 223 50, |
| 225 "Return 'Future' from 'async' function"); | 224 "Return 'Future' from 'async' function"); |
| 226 static const REPLACE_WITH_LITERAL = | |
| 227 const FixKind('REPLACE_WITH_LITERAL', 50, 'Replace with literal'); | |
| 228 static const REPLACE_WITH_NULL_AWARE = const FixKind( | 225 static const REPLACE_WITH_NULL_AWARE = const FixKind( |
| 229 'REPLACE_WITH_NULL_AWARE', | 226 'REPLACE_WITH_NULL_AWARE', |
| 230 50, | 227 50, |
| 231 "Replace the '.' with a '?.' in the invocation"); | 228 "Replace the '.' with a '?.' in the invocation"); |
| 232 static const USE_CONST = const FixKind('USE_CONST', 50, "Change to constant"); | 229 static const USE_CONST = const FixKind('USE_CONST', 50, "Change to constant"); |
| 233 static const USE_EFFECTIVE_INTEGER_DIVISION = const FixKind( | 230 static const USE_EFFECTIVE_INTEGER_DIVISION = const FixKind( |
| 234 'USE_EFFECTIVE_INTEGER_DIVISION', | 231 'USE_EFFECTIVE_INTEGER_DIVISION', |
| 235 50, | 232 50, |
| 236 "Use effective integer division ~/"); | 233 "Use effective integer division ~/"); |
| 237 static const USE_EQ_EQ_NULL = | 234 static const USE_EQ_EQ_NULL = |
| (...skipping 15 matching lines...) Expand all Loading... |
| 253 @override | 250 @override |
| 254 final AnalysisError error; | 251 final AnalysisError error; |
| 255 | 252 |
| 256 FixContextImpl(this.resourceProvider, this.analysisContext, this.error); | 253 FixContextImpl(this.resourceProvider, this.analysisContext, this.error); |
| 257 | 254 |
| 258 FixContextImpl.from(FixContext other) | 255 FixContextImpl.from(FixContext other) |
| 259 : resourceProvider = other.resourceProvider, | 256 : resourceProvider = other.resourceProvider, |
| 260 analysisContext = other.analysisContext, | 257 analysisContext = other.analysisContext, |
| 261 error = other.error; | 258 error = other.error; |
| 262 } | 259 } |
| OLD | NEW |