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

Side by Side Diff: pkg/analysis_server/lib/edit/fix/fix_dart.dart

Issue 1080653003: Create a public API for contributing fixes and make fixes pluggable (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Missed clean-up Created 5 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « pkg/analysis_server/lib/edit/fix/fix_core.dart ('k') | pkg/analysis_server/lib/plugin/fix.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2015, 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 library analysis_server.edit.fix.fix_dart;
6
7 import 'package:analysis_server/edit/fix/fix_core.dart';
8 import 'package:analyzer/src/generated/ast.dart';
9 import 'package:analyzer/src/generated/engine.dart';
10 import 'package:analyzer/src/generated/error.dart';
11 import 'package:analyzer/src/generated/source.dart';
12
13 /**
14 * A [FixContributor] that can be used to contribute fixes for errors in Dart
15 * files.
16 */
17 abstract class DartFixContributor extends FixContributor {
18 @override
19 List<Fix> computeFixes(AnalysisContext context, AnalysisError error) {
20 Source source = error.source;
21 if (!AnalysisEngine.isDartFileName(source.fullName)) {
22 return Fix.EMPTY_LIST;
23 }
24 List<Source> libraries = context.getLibrariesContaining(source);
25 if (libraries.isEmpty) {
26 return Fix.EMPTY_LIST;
27 }
28 CompilationUnit unit =
29 context.resolveCompilationUnit2(source, libraries[0]);
30 if (unit == null) {
31 return Fix.EMPTY_LIST;
32 }
33 return internalComputeFixes(unit, error);
34 }
35
36 /**
37 * Return a list of fixes for the given [error]. The error was reported
38 * against the given compilation [unit].
39 */
40 List<Fix> internalComputeFixes(CompilationUnit unit, AnalysisError error);
41 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/edit/fix/fix_core.dart ('k') | pkg/analysis_server/lib/plugin/fix.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698