| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 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 | 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 analysis_server.plugin.edit.fix.fix_dart; | 5 library analysis_server.plugin.edit.fix.fix_dart; |
| 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/src/services/correction/fix_internal.dart' | 10 import 'package:analysis_server/src/services/correction/fix_internal.dart' |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 AnalysisContext analysisContext = context.analysisContext; | 37 AnalysisContext analysisContext = context.analysisContext; |
| 38 Source source = context.error.source; | 38 Source source = context.error.source; |
| 39 if (!AnalysisEngine.isDartFileName(source.fullName)) { | 39 if (!AnalysisEngine.isDartFileName(source.fullName)) { |
| 40 return Fix.EMPTY_LIST; | 40 return Fix.EMPTY_LIST; |
| 41 } | 41 } |
| 42 List<Source> libraries = analysisContext.getLibrariesContaining(source); | 42 List<Source> libraries = analysisContext.getLibrariesContaining(source); |
| 43 if (libraries.isEmpty) { | 43 if (libraries.isEmpty) { |
| 44 return Fix.EMPTY_LIST; | 44 return Fix.EMPTY_LIST; |
| 45 } | 45 } |
| 46 CompilationUnit unit = | 46 CompilationUnit unit = |
| 47 analysisContext.resolveCompilationUnit2(source, libraries[0]); | 47 analysisContext.getResolvedCompilationUnit2(source, libraries[0]); |
| 48 if (unit == null) { | 48 if (unit == null) { |
| 49 return Fix.EMPTY_LIST; | 49 return Fix.EMPTY_LIST; |
| 50 } | 50 } |
| 51 DartFixContext dartContext = new DartFixContextImpl(context, unit); | 51 DartFixContext dartContext = new DartFixContextImpl(context, unit); |
| 52 return internalComputeFixes(dartContext); | 52 return internalComputeFixes(dartContext); |
| 53 } | 53 } |
| 54 | 54 |
| 55 /** | 55 /** |
| 56 * Return a list of fixes for the given [context]. | 56 * Return a list of fixes for the given [context]. |
| 57 */ | 57 */ |
| 58 Future<List<Fix>> internalComputeFixes(DartFixContext context); | 58 Future<List<Fix>> internalComputeFixes(DartFixContext context); |
| 59 } | 59 } |
| OLD | NEW |