| 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 == CompileTimeErrorCode.UNDEFINED_NAMED_PARAMETER || |
| 108 (errorCode is LintCode && | 109 (errorCode is LintCode && |
| 109 (errorCode.name == LintNames.annotate_overrides || | 110 (errorCode.name == LintNames.annotate_overrides || |
| 110 errorCode.name == LintNames.unnecessary_brace_in_string_interp)); | 111 errorCode.name == LintNames.unnecessary_brace_in_string_interp)); |
| 111 | 112 |
| 112 /** | 113 /** |
| 113 * An enumeration of possible quick fix kinds. | 114 * An enumeration of possible quick fix kinds. |
| 114 */ | 115 */ |
| 115 class DartFixKind { | 116 class DartFixKind { |
| 116 static const ADD_ASYNC = | 117 static const ADD_ASYNC = |
| 117 const FixKind('ADD_ASYNC', 50, "Add 'async' modifier"); | 118 const FixKind('ADD_ASYNC', 50, "Add 'async' modifier"); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 130 'ADD_PACKAGE_DEPENDENCY', 50, "Add dependency on package '{0}'"); | 131 'ADD_PACKAGE_DEPENDENCY', 50, "Add dependency on package '{0}'"); |
| 131 static const ADD_SUPER_CONSTRUCTOR_INVOCATION = const FixKind( | 132 static const ADD_SUPER_CONSTRUCTOR_INVOCATION = const FixKind( |
| 132 'ADD_SUPER_CONSTRUCTOR_INVOCATION', | 133 'ADD_SUPER_CONSTRUCTOR_INVOCATION', |
| 133 50, | 134 50, |
| 134 "Add super constructor {0} invocation"); | 135 "Add super constructor {0} invocation"); |
| 135 static const CHANGE_TO = const FixKind('CHANGE_TO', 49, "Change to '{0}'"); | 136 static const CHANGE_TO = const FixKind('CHANGE_TO', 49, "Change to '{0}'"); |
| 136 static const CHANGE_TO_STATIC_ACCESS = const FixKind( | 137 static const CHANGE_TO_STATIC_ACCESS = const FixKind( |
| 137 'CHANGE_TO_STATIC_ACCESS', 50, "Change access to static using '{0}'"); | 138 'CHANGE_TO_STATIC_ACCESS', 50, "Change access to static using '{0}'"); |
| 138 static const CHANGE_TYPE_ANNOTATION = const FixKind( | 139 static const CHANGE_TYPE_ANNOTATION = const FixKind( |
| 139 'CHANGE_TYPE_ANNOTATION', 50, "Change '{0}' to '{1}' type annotation"); | 140 'CHANGE_TYPE_ANNOTATION', 50, "Change '{0}' to '{1}' type annotation"); |
| 141 static const CONVERT_FLUTTER_CHILD = |
| 142 const FixKind('CONVERT_FLUTTER_CHILD', 50, "Convert to children:"); |
| 140 static const CREATE_CLASS = | 143 static const CREATE_CLASS = |
| 141 const FixKind('CREATE_CLASS', 50, "Create class '{0}'"); | 144 const FixKind('CREATE_CLASS', 50, "Create class '{0}'"); |
| 142 static const CREATE_CONSTRUCTOR = | 145 static const CREATE_CONSTRUCTOR = |
| 143 const FixKind('CREATE_CONSTRUCTOR', 50, "Create constructor '{0}'"); | 146 const FixKind('CREATE_CONSTRUCTOR', 50, "Create constructor '{0}'"); |
| 144 static const CREATE_CONSTRUCTOR_FOR_FINAL_FIELDS = const FixKind( | 147 static const CREATE_CONSTRUCTOR_FOR_FINAL_FIELDS = const FixKind( |
| 145 'CREATE_CONSTRUCTOR_FOR_FINAL_FIELDS', | 148 'CREATE_CONSTRUCTOR_FOR_FINAL_FIELDS', |
| 146 50, | 149 50, |
| 147 "Create constructor for final fields"); | 150 "Create constructor for final fields"); |
| 148 static const CREATE_CONSTRUCTOR_SUPER = const FixKind( | 151 static const CREATE_CONSTRUCTOR_SUPER = const FixKind( |
| 149 'CREATE_CONSTRUCTOR_SUPER', 50, "Create constructor to call {0}"); | 152 'CREATE_CONSTRUCTOR_SUPER', 50, "Create constructor to call {0}"); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 @override | 246 @override |
| 244 final AnalysisError error; | 247 final AnalysisError error; |
| 245 | 248 |
| 246 FixContextImpl(this.resourceProvider, this.analysisContext, this.error); | 249 FixContextImpl(this.resourceProvider, this.analysisContext, this.error); |
| 247 | 250 |
| 248 FixContextImpl.from(FixContext other) | 251 FixContextImpl.from(FixContext other) |
| 249 : resourceProvider = other.resourceProvider, | 252 : resourceProvider = other.resourceProvider, |
| 250 analysisContext = other.analysisContext, | 253 analysisContext = other.analysisContext, |
| 251 error = other.error; | 254 error = other.error; |
| 252 } | 255 } |
| OLD | NEW |