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 services.correction.fix; | 5 library services.correction.fix; |
6 | 6 |
7 import 'package:analysis_services/correction/change.dart'; | 7 import 'package:analysis_services/correction/change.dart'; |
8 import 'package:analysis_services/search/search_engine.dart'; | 8 import 'package:analysis_services/search/search_engine.dart'; |
9 import 'package:analysis_services/src/correction/fix.dart'; | 9 import 'package:analysis_services/src/correction/fix.dart'; |
10 import 'package:analyzer/src/generated/ast.dart'; | 10 import 'package:analyzer/src/generated/ast.dart'; |
11 import 'package:analyzer/src/generated/error.dart'; | 11 import 'package:analyzer/src/generated/error.dart'; |
| 12 import 'package:analyzer/src/generated/source.dart'; |
12 | 13 |
13 | 14 |
14 /** | 15 /** |
15 * Computes [Fix]s for the given [AnalysisError]. | 16 * Computes [Fix]s for the given [AnalysisError]. |
16 * | 17 * |
17 * Returns the computed [Fix]s, not `null`. | 18 * Returns the computed [Fix]s, not `null`. |
18 */ | 19 */ |
19 List<Fix> computeFixes(SearchEngine searchEngine, String file, | 20 List<Fix> computeFixes(SearchEngine searchEngine, |
20 CompilationUnit unit, AnalysisError error) { | 21 CompilationUnit unit, AnalysisError error) { |
21 var processor = new FixProcessor(searchEngine, file, unit, error); | 22 Source source = unit.element.source; |
| 23 String file = source.fullName; |
| 24 var processor = new FixProcessor(searchEngine, source, file, unit, error); |
22 return processor.compute(); | 25 return processor.compute(); |
23 } | 26 } |
24 | 27 |
25 | 28 |
26 /** | 29 /** |
27 * A description of a single proposed fix for some problem. | 30 * A description of a single proposed fix for some problem. |
28 */ | 31 */ |
29 class Fix { | 32 class Fix { |
30 final FixKind kind; | 33 final FixKind kind; |
31 final Change change; | 34 final Change change; |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 // "Surround with 'try-finally'"); | 216 // "Surround with 'try-finally'"); |
214 // static const QA_SURROUND_WITH_WHILE = | 217 // static const QA_SURROUND_WITH_WHILE = |
215 // const AssistKind('QA_SURROUND_WITH_WHILE', 30, "Surround with 'while'"); | 218 // const AssistKind('QA_SURROUND_WITH_WHILE', 30, "Surround with 'while'"); |
216 // | 219 // |
217 // final name; | 220 // final name; |
218 // final int relevance; | 221 // final int relevance; |
219 // final String message; | 222 // final String message; |
220 // | 223 // |
221 // const AssistKind(this.name, this.relevance, this.message); | 224 // const AssistKind(this.name, this.relevance, this.message); |
222 //} | 225 //} |
OLD | NEW |