| 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_server/src/protocol.dart' show SourceChange; | 7 import 'package:analysis_server/src/protocol.dart' show SourceChange; |
| 8 import 'package:analysis_server/src/services/correction/fix_internal.dart'; | 8 import 'package:analysis_server/src/services/correction/fix_internal.dart'; |
| 9 import 'package:analysis_server/src/services/search/search_engine.dart'; | |
| 10 import 'package:analyzer/src/generated/ast.dart'; | 9 import 'package:analyzer/src/generated/ast.dart'; |
| 11 import 'package:analyzer/src/generated/error.dart'; | 10 import 'package:analyzer/src/generated/error.dart'; |
| 12 | 11 |
| 13 | 12 |
| 14 /** | 13 /** |
| 15 * Computes [Fix]s for the given [AnalysisError]. | 14 * Computes [Fix]s for the given [AnalysisError]. |
| 16 * | 15 * |
| 17 * Returns the computed [Fix]s, not `null`. | 16 * Returns the computed [Fix]s, not `null`. |
| 18 */ | 17 */ |
| 19 List<Fix> computeFixes(SearchEngine searchEngine, CompilationUnit unit, | 18 List<Fix> computeFixes(CompilationUnit unit, AnalysisError error) { |
| 20 AnalysisError error) { | 19 var processor = new FixProcessor(unit, error); |
| 21 var processor = new FixProcessor(searchEngine, unit, error); | |
| 22 List<Fix> fixes = processor.compute(); | 20 List<Fix> fixes = processor.compute(); |
| 23 fixes.sort((Fix a, Fix b) { | 21 fixes.sort((Fix a, Fix b) { |
| 24 return a.kind.relevance - b.kind.relevance; | 22 return a.kind.relevance - b.kind.relevance; |
| 25 }); | 23 }); |
| 26 return fixes; | 24 return fixes; |
| 27 } | 25 } |
| 28 | 26 |
| 29 | 27 |
| 30 /** | 28 /** |
| 31 * A description of a single proposed fix for some problem. | 29 * A description of a single proposed fix for some problem. |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 | 130 |
| 133 final name; | 131 final name; |
| 134 final int relevance; | 132 final int relevance; |
| 135 final String message; | 133 final String message; |
| 136 | 134 |
| 137 const FixKind(this.name, this.relevance, this.message); | 135 const FixKind(this.name, this.relevance, this.message); |
| 138 | 136 |
| 139 @override | 137 @override |
| 140 String toString() => name; | 138 String toString() => name; |
| 141 } | 139 } |
| OLD | NEW |