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

Side by Side Diff: pkg/analysis_server/lib/src/services/refactoring/extract_method.dart

Issue 534123002: Integrate EXTRACT_METHOD refactoring 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 unified diff | Download patch | Annotate | Revision Log
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 services.src.refactoring.extract_method; 5 library services.src.refactoring.extract_method;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/protocol.dart' hide Element; 9 import 'package:analysis_server/src/protocol.dart' hide Element;
10 import 'package:analysis_server/src/services/correction/name_suggestion.dart'; 10 import 'package:analysis_server/src/services/correction/name_suggestion.dart';
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 } 453 }
454 454
455 /** 455 /**
456 * Returns the selected [Expression] source, with applying new parameter 456 * Returns the selected [Expression] source, with applying new parameter
457 * names. 457 * names.
458 */ 458 */
459 String _getMethodBodySource() { 459 String _getMethodBodySource() {
460 String source = utils.getRangeText(selectionRange); 460 String source = utils.getRangeText(selectionRange);
461 // prepare operations to replace variables with parameters 461 // prepare operations to replace variables with parameters
462 List<SourceEdit> replaceEdits = []; 462 List<SourceEdit> replaceEdits = [];
463 for (RefactoringMethodParameter parameter in _parametersMap.values) { 463 for (RefactoringMethodParameter parameter in _parameters) {
464 List<SourceRange> ranges = _parameterReferencesMap[parameter.id]; 464 List<SourceRange> ranges = _parameterReferencesMap[parameter.id];
465 if (ranges != null) { 465 if (ranges != null) {
466 for (SourceRange range in ranges) { 466 for (SourceRange range in ranges) {
467 replaceEdits.add( 467 replaceEdits.add(
468 new SourceEdit( 468 new SourceEdit(
469 range.offset - selectionRange.offset, 469 range.offset - selectionRange.offset,
470 range.length, 470 range.length,
471 parameter.name)); 471 parameter.name));
472 } 472 }
473 } 473 }
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
1098 1098
1099 /** 1099 /**
1100 * Generalized version of some source, in which references to the specific 1100 * Generalized version of some source, in which references to the specific
1101 * variables are replaced with pattern variables, with back mapping from the 1101 * variables are replaced with pattern variables, with back mapping from the
1102 * pattern to the original variable names. 1102 * pattern to the original variable names.
1103 */ 1103 */
1104 class _SourcePattern { 1104 class _SourcePattern {
1105 String patternSource; 1105 String patternSource;
1106 Map<String, String> originalToPatternNames = {}; 1106 Map<String, String> originalToPatternNames = {};
1107 } 1107 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/edit/edit_domain.dart ('k') | pkg/analysis_server/test/edit/refactoring_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698