Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(228)

Side by Side Diff: pkg/analyzer_plugin/lib/src/utilities/fixes/fixes.dart

Issue 2923283002: Add support for fixes (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
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.
4
5 import 'package:analyzer/dart/analysis/results.dart';
6 import 'package:analyzer/error/error.dart';
7 import 'package:analyzer/file_system/file_system.dart';
8 import 'package:analyzer_plugin/protocol/protocol_generated.dart';
9 import 'package:analyzer_plugin/utilities/analyzer_converter.dart';
10 import 'package:analyzer_plugin/utilities/fixes/fixes.dart';
11
12 /**
13 * A concrete implementation of [FixCollector].
14 */
15 class FixCollectorImpl implements FixCollector {
16 /**
17 * The list of fixes that have been collected.
18 */
19 final Map<AnalysisError, List<PrioritizedSourceChange>> fixMap =
20 <AnalysisError, List<PrioritizedSourceChange>>{};
21
22 /**
23 * Return the fixes that have been collected up to this point.
24 */
25 List<AnalysisErrorFixes> get fixes {
26 List<AnalysisErrorFixes> fixes = <AnalysisErrorFixes>[];
27 AnalyzerConverter converter = new AnalyzerConverter();
28 for (AnalysisError error in fixMap.keys) {
29 fixes.add(new AnalysisErrorFixes(converter.convertAnalysisError(error),
30 fixes: fixMap[error]));
31 }
32 return fixes;
33 }
34
35 @override
36 void addFix(AnalysisError error, PrioritizedSourceChange change) {
37 fixMap.putIfAbsent(error, () => <PrioritizedSourceChange>[]).add(change);
38 }
39 }
40
41 /**
42 * A concrete implementation of [FixesRequest].
43 */
44 class FixesRequestImpl implements FixesRequest {
45 @override
46 AnalysisError error;
47
48 @override
49 final ResourceProvider resourceProvider;
50
51 @override
52 final int offset;
53
54 @override
55 final ResolveResult result;
56
57 /**
58 * Initialize a newly create request with the given data.
59 */
60 FixesRequestImpl(this.resourceProvider, this.offset, this.result);
61 }
OLDNEW
« no previous file with comments | « pkg/analyzer_plugin/lib/plugin/fix_mixin.dart ('k') | pkg/analyzer_plugin/lib/utilities/fixes/fixes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698