Chromium Code Reviews| Index: pkg/analysis_server/lib/src/edit/edit_domain.dart |
| diff --git a/pkg/analysis_server/lib/src/edit/edit_domain.dart b/pkg/analysis_server/lib/src/edit/edit_domain.dart |
| index 58137c69cd68db11521f1754ff2b3aa07765828b..d42ad4241d96e39ca45705a35d887e78f7461b9d 100644 |
| --- a/pkg/analysis_server/lib/src/edit/edit_domain.dart |
| +++ b/pkg/analysis_server/lib/src/edit/edit_domain.dart |
| @@ -403,8 +403,11 @@ class EditDomainHandler implements RequestHandler { |
| if (element != null) { |
| // try CONVERT_METHOD_TO_GETTER |
| if (element is ExecutableElement) { |
| - Refactoring refactoring = |
| - new ConvertMethodToGetterRefactoring(searchEngine, element); |
| + Refactoring refactoring = new ConvertMethodToGetterRefactoring( |
| + searchEngine, |
| + (element) => |
| + throw new StateError('Unexpected resolved unit request.'), |
|
Brian Wilkerson
2016/11/30 17:34:18
I guess this is fine, but I was thinking of passin
|
| + element); |
| RefactoringStatus status = await refactoring.checkInitialConditions(); |
| if (!status.hasFatalError) { |
| kinds.add(RefactoringKind.CONVERT_METHOD_TO_GETTER); |
| @@ -684,6 +687,11 @@ class _RefactoringManager { |
| } |
| } |
| + Future<CompilationUnit> _getResolvedUnit(Element element) { |
| + String path = element.source.fullName; |
| + return server.getResolvedCompilationUnit(path); |
| + } |
| + |
| /** |
| * Initializes this context to perform a refactoring with the specified |
| * parameters. The existing [Refactoring] is reused or created as needed. |
| @@ -723,8 +731,8 @@ class _RefactoringManager { |
| if (element != null) { |
| if (element is ExecutableElement) { |
| _resetOnAnalysisStarted(); |
| - refactoring = |
| - new ConvertMethodToGetterRefactoring(searchEngine, element); |
| + refactoring = new ConvertMethodToGetterRefactoring( |
| + searchEngine, _getResolvedUnit, element); |
| } |
| } |
| } |
| @@ -760,11 +768,8 @@ class _RefactoringManager { |
| CompilationUnit unit = await server.getResolvedCompilationUnit(file); |
| if (unit != null) { |
| _resetOnAnalysisStarted(); |
| - refactoring = |
| - new InlineMethodRefactoring(searchEngine, (Element element) async { |
| - String elementPath = element.source.fullName; |
| - return await server.getResolvedCompilationUnit(elementPath); |
| - }, unit, offset); |
| + refactoring = new InlineMethodRefactoring( |
| + searchEngine, _getResolvedUnit, unit, offset); |
| } |
| } |
| if (kind == RefactoringKind.MOVE_FILE) { |