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

Side by Side Diff: pkg/analysis_server/lib/src/edit/edit_domain.dart

Issue 591083003: Integrate CONVERT_METHOD_TO_GETTER into the server. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/analysis_server/test/edit/refactoring_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/analysis_server.dart'; 9 import 'package:analysis_server/src/analysis_server.dart';
10 import 'package:analysis_server/src/constants.dart'; 10 import 'package:analysis_server/src/constants.dart';
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 bool get _hasFatalError { 188 bool get _hasFatalError {
189 return initStatus.hasFatalError || 189 return initStatus.hasFatalError ||
190 optionsStatus.hasFatalError || 190 optionsStatus.hasFatalError ||
191 finalStatus.hasFatalError; 191 finalStatus.hasFatalError;
192 } 192 }
193 193
194 /** 194 /**
195 * Checks if [refactoring] requires options. 195 * Checks if [refactoring] requires options.
196 */ 196 */
197 bool get _requiresOptions { 197 bool get _requiresOptions {
198 if (refactoring is InlineLocalRefactoring) { 198 if (refactoring is ConvertMethodToGetterRefactoring ||
199 refactoring is InlineLocalRefactoring) {
199 return false; 200 return false;
200 } 201 }
201 return true; 202 return true;
202 } 203 }
203 204
204 void getRefactoring(Request request) { 205 void getRefactoring(Request request) {
205 // prepare for processing the request 206 // prepare for processing the request
206 requestId = request.id; 207 requestId = request.id;
207 result = new EditGetRefactoringResult( 208 result = new EditGetRefactoringResult(
208 EMPTY_PROBLEM_LIST, 209 EMPTY_PROBLEM_LIST,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 this.offset == offset && 259 this.offset == offset &&
259 this.length == length) { 260 this.length == length) {
260 return new Future.value(initStatus); 261 return new Future.value(initStatus);
261 } 262 }
262 _reset(); 263 _reset();
263 this.kind = kind; 264 this.kind = kind;
264 this.file = file; 265 this.file = file;
265 this.offset = offset; 266 this.offset = offset;
266 this.length = length; 267 this.length = length;
267 // create a new Refactoring instance 268 // create a new Refactoring instance
269 if (kind == RefactoringKind.CONVERT_METHOD_TO_GETTER) {
270 List<Element> elements = server.getElementsAtOffset(file, offset);
271 if (elements.isNotEmpty) {
272 Element element = elements[0];
273 if (element is ExecutableElement) {
274 refactoring =
275 new ConvertMethodToGetterRefactoring(searchEngine, element);
276 }
277 }
278 }
268 if (kind == RefactoringKind.EXTRACT_LOCAL_VARIABLE) { 279 if (kind == RefactoringKind.EXTRACT_LOCAL_VARIABLE) {
269 List<CompilationUnit> units = server.getResolvedCompilationUnits(file); 280 List<CompilationUnit> units = server.getResolvedCompilationUnits(file);
270 if (units.isNotEmpty) { 281 if (units.isNotEmpty) {
271 refactoring = new ExtractLocalRefactoring(units[0], offset, length); 282 refactoring = new ExtractLocalRefactoring(units[0], offset, length);
272 feedback = new ExtractLocalVariableFeedback([], [], []); 283 feedback = new ExtractLocalVariableFeedback([], [], []);
273 } 284 }
274 } 285 }
275 if (kind == RefactoringKind.EXTRACT_METHOD) { 286 if (kind == RefactoringKind.EXTRACT_METHOD) {
276 List<CompilationUnit> units = server.getResolvedCompilationUnits(file); 287 List<CompilationUnit> units = server.getResolvedCompilationUnits(file);
277 if (units.isNotEmpty) { 288 if (units.isNotEmpty) {
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 456
446 @override 457 @override
447 void analysisComplete() { 458 void analysisComplete() {
448 } 459 }
449 460
450 @override 461 @override
451 void analysisStarted(engine.AnalysisContext context) { 462 void analysisStarted(engine.AnalysisContext context) {
452 refactoringManager._reset(); 463 refactoringManager._reset();
453 } 464 }
454 } 465 }
OLDNEW
« 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