Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(253)

Unified Diff: pkg/analysis_server/lib/src/edit/edit_domain.dart

Issue 540503002: Integrate INLINE_LOCAL_VARIABLE into the server. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analysis_server/test/edit/refactoring_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 23ba92f3176dc77ad8f0e1a4eb3d451fcd811b10..7076ea6c51150dcac0f4e8a0739ad17fd5289415 100644
--- a/pkg/analysis_server/lib/src/edit/edit_domain.dart
+++ b/pkg/analysis_server/lib/src/edit/edit_domain.dart
@@ -185,6 +185,16 @@ class _RefactoringManager {
finalStatus.hasFatalError;
}
+ /**
+ * Checks if [refactoring] requires options.
+ */
+ bool get _requiresOptions {
+ if (refactoring is InlineLocalRefactoring) {
+ return false;
+ }
+ return true;
+ }
+
void getRefactoring(Request request) {
// prepare for processing the request
requestId = request.id;
@@ -196,12 +206,14 @@ class _RefactoringManager {
return _sendResultResponse();
}
// set options
- if (params.options == null) {
- return _sendResultResponse();
- }
- optionsStatus = _setOptions(params, request);
- if (_hasFatalError) {
- return _sendResultResponse();
+ if (_requiresOptions) {
+ if (params.options == null) {
+ return _sendResultResponse();
+ }
+ optionsStatus = _setOptions(params, request);
+ if (_hasFatalError) {
+ return _sendResultResponse();
+ }
}
// done if just validation
if (params.validateOnly) {
@@ -257,10 +269,18 @@ class _RefactoringManager {
new ExtractMethodFeedback(offset, length, null, [], false, [], [], []);
}
}
+ if (kind == RefactoringKind.INLINE_LOCAL_VARIABLE) {
+ List<CompilationUnit> units = server.getResolvedCompilationUnits(file);
+ if (units.isNotEmpty) {
+ refactoring =
+ new InlineLocalRefactoring(searchEngine, units[0], offset);
+ }
+ }
if (kind == RefactoringKind.INLINE_METHOD) {
List<CompilationUnit> units = server.getResolvedCompilationUnits(file);
if (units.isNotEmpty) {
- refactoring = new InlineMethodRefactoring(searchEngine, units[0], offset);
+ refactoring =
+ new InlineMethodRefactoring(searchEngine, units[0], offset);
}
}
if (kind == RefactoringKind.RENAME) {
@@ -352,6 +372,9 @@ class _RefactoringManager {
extractRefactoring.returnType = extractOptions.returnType;
return extractRefactoring.checkName();
}
+ if (refactoring is InlineLocalRefactoring) {
+ return new RefactoringStatus();
+ }
if (refactoring is InlineMethodRefactoring) {
InlineMethodRefactoring inlineRefactoring = this.refactoring;
InlineMethodOptions inlineOptions =
« no previous file with comments | « no previous file | pkg/analysis_server/test/edit/refactoring_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698