| 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 edit.domain; | 5 library edit.domain; |
| 6 | 6 |
| 7 import 'package:analysis_server/src/analysis_server.dart'; | 7 import 'package:analysis_server/src/analysis_server.dart'; |
| 8 import 'package:analysis_server/src/computer/error.dart'; | |
| 9 import 'package:analysis_server/src/constants.dart'; | 8 import 'package:analysis_server/src/constants.dart'; |
| 10 import 'package:analysis_server/src/edit/fix.dart'; | 9 import 'package:analysis_server/src/edit/fix.dart'; |
| 11 import 'package:analysis_server/src/protocol.dart'; | 10 import 'package:analysis_server/src/protocol.dart'; |
| 12 import 'package:analysis_server/src/protocol2.dart' show AnalysisError, | 11 import 'package:analysis_server/src/protocol2.dart' show AnalysisError, |
| 13 EditGetAssistsParams, EditGetAvailableRefactoringsParams, | 12 EditGetAssistsParams, EditGetAvailableRefactoringsParams, |
| 14 EditGetFixesParams; | 13 EditGetFixesParams; |
| 15 import 'package:analysis_server/src/services/correction/assist.dart'; | 14 import 'package:analysis_server/src/services/correction/assist.dart'; |
| 16 import 'package:analysis_server/src/services/correction/change.dart'; | 15 import 'package:analysis_server/src/services/correction/change.dart'; |
| 17 import 'package:analysis_server/src/services/correction/fix.dart'; | 16 import 'package:analysis_server/src/services/correction/fix.dart'; |
| 18 import 'package:analysis_server/src/services/json.dart'; | 17 import 'package:analysis_server/src/services/json.dart'; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 // TODO(paulberry): params.offset isn't used. Is this a bug? | 87 // TODO(paulberry): params.offset isn't used. Is this a bug? |
| 89 List<ErrorFixes> errorFixesList = <ErrorFixes>[]; | 88 List<ErrorFixes> errorFixesList = <ErrorFixes>[]; |
| 90 List<CompilationUnit> units = server.getResolvedCompilationUnits(params.file
); | 89 List<CompilationUnit> units = server.getResolvedCompilationUnits(params.file
); |
| 91 for (CompilationUnit unit in units) { | 90 for (CompilationUnit unit in units) { |
| 92 engine.AnalysisErrorInfo errorInfo = server.getErrors(params.file); | 91 engine.AnalysisErrorInfo errorInfo = server.getErrors(params.file); |
| 93 if (errorInfo != null) { | 92 if (errorInfo != null) { |
| 94 for (engine.AnalysisError error in errorInfo.errors) { | 93 for (engine.AnalysisError error in errorInfo.errors) { |
| 95 List<Fix> fixes = computeFixes(searchEngine, unit, error); | 94 List<Fix> fixes = computeFixes(searchEngine, unit, error); |
| 96 if (fixes.isNotEmpty) { | 95 if (fixes.isNotEmpty) { |
| 97 AnalysisError serverError = | 96 AnalysisError serverError = |
| 98 analysisErrorFromEngine(errorInfo.lineInfo, error); | 97 new AnalysisError.fromEngine(errorInfo.lineInfo, error); |
| 99 ErrorFixes errorFixes = new ErrorFixes(serverError); | 98 ErrorFixes errorFixes = new ErrorFixes(serverError); |
| 100 errorFixesList.add(errorFixes); | 99 errorFixesList.add(errorFixes); |
| 101 fixes.forEach((fix) { | 100 fixes.forEach((fix) { |
| 102 errorFixes.addFix(fix); | 101 errorFixes.addFix(fix); |
| 103 }); | 102 }); |
| 104 } | 103 } |
| 105 } | 104 } |
| 106 } | 105 } |
| 107 } | 106 } |
| 108 // respond | 107 // respond |
| (...skipping 21 matching lines...) Expand all Loading... |
| 130 | 129 |
| 131 class RefactoringKind { | 130 class RefactoringKind { |
| 132 static const String CONVERT_GETTER_TO_METHOD = 'CONVERT_GETTER_TO_METHOD'; | 131 static const String CONVERT_GETTER_TO_METHOD = 'CONVERT_GETTER_TO_METHOD'; |
| 133 static const String CONVERT_METHOD_TO_GETTER = 'CONVERT_METHOD_TO_GETTER'; | 132 static const String CONVERT_METHOD_TO_GETTER = 'CONVERT_METHOD_TO_GETTER'; |
| 134 static const String EXTRACT_LOCAL_VARIABLE = 'EXTRACT_LOCAL_VARIABLE'; | 133 static const String EXTRACT_LOCAL_VARIABLE = 'EXTRACT_LOCAL_VARIABLE'; |
| 135 static const String EXTRACT_METHOD = 'EXTRACT_METHOD'; | 134 static const String EXTRACT_METHOD = 'EXTRACT_METHOD'; |
| 136 static const String INLINE_LOCAL_VARIABLE = 'INLINE_LOCAL_VARIABLE'; | 135 static const String INLINE_LOCAL_VARIABLE = 'INLINE_LOCAL_VARIABLE'; |
| 137 static const String INLINE_METHOD = 'INLINE_METHOD'; | 136 static const String INLINE_METHOD = 'INLINE_METHOD'; |
| 138 static const String RENAME = 'RENAME'; | 137 static const String RENAME = 'RENAME'; |
| 139 } | 138 } |
| OLD | NEW |