Index: pkg/analyzer_plugin/lib/utilities/fixes/fixes.dart |
diff --git a/pkg/analyzer_plugin/lib/utilities/fixes/fixes.dart b/pkg/analyzer_plugin/lib/utilities/fixes/fixes.dart |
index e105dfbe41ddba591d610215ba5f0a3d44e5d170..a98c0adfae31b9747938dd7e33895b488f51ad18 100644 |
--- a/pkg/analyzer_plugin/lib/utilities/fixes/fixes.dart |
+++ b/pkg/analyzer_plugin/lib/utilities/fixes/fixes.dart |
@@ -12,6 +12,19 @@ import 'package:analyzer_plugin/src/utilities/fixes/fixes.dart'; |
import 'package:analyzer_plugin/utilities/generator.dart'; |
/** |
+ * The information about a requested set of fixes when computing fixes in a |
+ * `.dart` file. |
+ * |
+ * Clients may not extend, implement or mix-in this class. |
+ */ |
+abstract class DartFixesRequest implements FixesRequest { |
+ /** |
+ * The analysis result for the file in which the fixes are being requested. |
+ */ |
+ ResolveResult get result; |
+} |
+ |
+/** |
* An object that [FixContributor]s use to record fixes. |
* |
* Clients may not extend, implement or mix-in this class. |
@@ -33,7 +46,7 @@ abstract class FixContributor { |
* Contribute fixes for the location in the file specified by the given |
* [request] into the given [collector]. |
*/ |
- void computeFixes(FixesRequest request, FixCollector collector); |
+ void computeFixes(covariant FixesRequest request, FixCollector collector); |
} |
/** |
@@ -57,11 +70,6 @@ abstract class FixesRequest { |
* Return the resource provider associated with this request. |
*/ |
ResourceProvider get resourceProvider; |
- |
- /** |
- * The analysis result for the file in which the fixes are being requested. |
- */ |
- ResolveResult get result; |
} |
/** |
@@ -85,7 +93,7 @@ class FixGenerator { |
* by the given [request]. If any of the contributors throws an exception, |
* also create a non-fatal 'plugin.error' notification. |
*/ |
- GeneratorResult generateFixesResponse(FixesRequest request) { |
+ GeneratorResult generateFixesResponse(DartFixesRequest request) { |
Brian Wilkerson
2017/06/22 17:12:21
I'm not entirely thrilled with this change. The al
maxkim
2017/06/22 20:52:56
Adding a 'List<AnalysisError> get errorsAtOffset'
Brian Wilkerson
2017/06/22 22:07:01
Yeah, I'm starting to think that you're right, and
maxkim
2017/06/22 23:18:19
Acknowledged.
|
List<Notification> notifications = <Notification>[]; |
FixCollectorImpl collector = new FixCollectorImpl(); |
Iterable<AnalysisError> errors = _getErrors(request); |
@@ -108,7 +116,7 @@ class FixGenerator { |
return new GeneratorResult(result, notifications); |
} |
- Iterable<AnalysisError> _getErrors(FixesRequest request) { |
+ Iterable<AnalysisError> _getErrors(DartFixesRequest request) { |
maxkim
2017/06/22 20:52:57
If we put 'errorsAtOffset' within FixesRequest, th
|
int offset = request.offset; |
LineInfo lineInfo = request.result.lineInfo; |
int offsetLine = lineInfo.getLocation(offset).lineNumber; |