| 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 test.services.correction.fix; | 5 library test.services.correction.fix; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/plugin/edit/fix/fix_core.dart'; | 9 import 'package:analysis_server/plugin/edit/fix/fix_core.dart'; |
| 10 import 'package:analysis_server/plugin/edit/fix/fix_dart.dart'; | 10 import 'package:analysis_server/plugin/edit/fix/fix_dart.dart'; |
| 11 import 'package:analysis_server/plugin/protocol/protocol.dart' | 11 import 'package:analysis_server/plugin/protocol/protocol.dart' |
| 12 hide AnalysisError; | 12 hide AnalysisError; |
| 13 import 'package:analysis_server/src/services/correction/fix.dart'; | 13 import 'package:analysis_server/src/services/correction/fix.dart'; |
| 14 import 'package:analysis_server/src/services/correction/fix_internal.dart'; | 14 import 'package:analysis_server/src/services/correction/fix_internal.dart'; |
| 15 import 'package:analyzer/dart/ast/ast.dart'; | 15 import 'package:analyzer/dart/ast/ast.dart'; |
| 16 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; | 16 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; |
| 17 import 'package:analyzer/error/error.dart'; | 17 import 'package:analyzer/error/error.dart'; |
| 18 import 'package:analyzer/file_system/file_system.dart'; | 18 import 'package:analyzer/file_system/file_system.dart'; |
| 19 import 'package:analyzer/source/package_map_resolver.dart'; | 19 import 'package:analyzer/source/package_map_resolver.dart'; |
| 20 import 'package:analyzer/src/dart/analysis/ast_provider_driver.dart'; |
| 21 import 'package:analyzer/src/dart/element/ast_provider.dart'; |
| 20 import 'package:analyzer/src/error/codes.dart'; | 22 import 'package:analyzer/src/error/codes.dart'; |
| 21 import 'package:analyzer/src/generated/engine.dart'; | 23 import 'package:analyzer/src/generated/engine.dart'; |
| 22 import 'package:analyzer/src/generated/parser.dart'; | 24 import 'package:analyzer/src/generated/parser.dart'; |
| 23 import 'package:analyzer/src/generated/source.dart'; | 25 import 'package:analyzer/src/generated/source.dart'; |
| 24 import 'package:test/test.dart'; | 26 import 'package:test/test.dart'; |
| 25 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 27 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 26 | 28 |
| 27 import '../../abstract_single_unit.dart'; | 29 import '../../abstract_single_unit.dart'; |
| 28 | 30 |
| 29 main() { | 31 main() { |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 | 156 |
| 155 /** | 157 /** |
| 156 * Computes fixes for the given [error] in [testUnit]. | 158 * Computes fixes for the given [error] in [testUnit]. |
| 157 */ | 159 */ |
| 158 Future<List<Fix>> _computeFixes(AnalysisError error) async { | 160 Future<List<Fix>> _computeFixes(AnalysisError error) async { |
| 159 if (enableNewAnalysisDriver) { | 161 if (enableNewAnalysisDriver) { |
| 160 DartFixContext fixContext = new _DartFixContextImpl( | 162 DartFixContext fixContext = new _DartFixContextImpl( |
| 161 provider, | 163 provider, |
| 162 driver.getTopLevelNameDeclarations, | 164 driver.getTopLevelNameDeclarations, |
| 163 resolutionMap.elementDeclaredByCompilationUnit(testUnit).context, | 165 resolutionMap.elementDeclaredByCompilationUnit(testUnit).context, |
| 166 new AstProviderForDriver(driver), |
| 164 testUnit, | 167 testUnit, |
| 165 error); | 168 error); |
| 166 return await new DefaultFixContributor().internalComputeFixes(fixContext); | 169 return await new DefaultFixContributor().internalComputeFixes(fixContext); |
| 167 } else { | 170 } else { |
| 168 FixContextImpl fixContext = new FixContextImpl(provider, context, error); | 171 FixContextImpl fixContext = new FixContextImpl(provider, context, error); |
| 169 DefaultFixContributor contributor = new DefaultFixContributor(); | 172 DefaultFixContributor contributor = new DefaultFixContributor(); |
| 170 return contributor.computeFixes(fixContext); | 173 return contributor.computeFixes(fixContext); |
| 171 } | 174 } |
| 172 } | 175 } |
| 173 | 176 |
| (...skipping 5466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5640 @override | 5643 @override |
| 5641 final ResourceProvider resourceProvider; | 5644 final ResourceProvider resourceProvider; |
| 5642 | 5645 |
| 5643 @override | 5646 @override |
| 5644 final GetTopLevelDeclarations getTopLevelDeclarations; | 5647 final GetTopLevelDeclarations getTopLevelDeclarations; |
| 5645 | 5648 |
| 5646 @override | 5649 @override |
| 5647 final AnalysisContext analysisContext; | 5650 final AnalysisContext analysisContext; |
| 5648 | 5651 |
| 5649 @override | 5652 @override |
| 5653 final AstProvider astProvider; |
| 5654 |
| 5655 @override |
| 5650 final CompilationUnit unit; | 5656 final CompilationUnit unit; |
| 5651 | 5657 |
| 5652 @override | 5658 @override |
| 5653 final AnalysisError error; | 5659 final AnalysisError error; |
| 5654 | 5660 |
| 5655 _DartFixContextImpl(this.resourceProvider, this.getTopLevelDeclarations, | 5661 _DartFixContextImpl(this.resourceProvider, this.getTopLevelDeclarations, |
| 5656 this.analysisContext, this.unit, this.error); | 5662 this.analysisContext, this.astProvider, this.unit, this.error); |
| 5657 } | 5663 } |
| OLD | NEW |