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

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

Issue 1628623002: Isse 25404. When remove a method during inlining, remove also leading empty lines. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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
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.inline_method; 5 library services.src.refactoring.inline_method;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/protocol_server.dart' hide Element; 9 import 'package:analysis_server/src/protocol_server.dart' hide Element;
10 import 'package:analysis_server/src/services/correction/source_range.dart'; 10 import 'package:analysis_server/src/services/correction/source_range.dart';
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 if (deleteSource && !inlineAll) { 256 if (deleteSource && !inlineAll) {
257 result.addError('All references must be inlined to remove the source.'); 257 result.addError('All references must be inlined to remove the source.');
258 } 258 }
259 // prepare changes 259 // prepare changes
260 for (_ReferenceProcessor processor in _referenceProcessors) { 260 for (_ReferenceProcessor processor in _referenceProcessors) {
261 processor._process(result); 261 processor._process(result);
262 } 262 }
263 // delete method 263 // delete method
264 if (deleteSource && inlineAll) { 264 if (deleteSource && inlineAll) {
265 SourceRange methodRange = rangeNode(_methodNode); 265 SourceRange methodRange = rangeNode(_methodNode);
266 SourceRange linesRange = _methodUtils.getLinesRange(methodRange); 266 SourceRange linesRange =
267 _methodUtils.getLinesRange(methodRange, skipLeadingEmptyLines: true);
267 doSourceChange_addElementEdit( 268 doSourceChange_addElementEdit(
268 change, _methodElement, newSourceEdit_range(linesRange, '')); 269 change, _methodElement, newSourceEdit_range(linesRange, ''));
269 } 270 }
270 // done 271 // done
271 return new Future.value(result); 272 return new Future.value(result);
272 } 273 }
273 274
274 @override 275 @override
275 Future<RefactoringStatus> checkInitialConditions() async { 276 Future<RefactoringStatus> checkInitialConditions() async {
276 RefactoringStatus result = new RefactoringStatus(); 277 RefactoringStatus result = new RefactoringStatus();
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 } 823 }
823 824
824 void _addVariable(SimpleIdentifier node) { 825 void _addVariable(SimpleIdentifier node) {
825 VariableElement variableElement = getLocalVariableElement(node); 826 VariableElement variableElement = getLocalVariableElement(node);
826 if (variableElement != null) { 827 if (variableElement != null) {
827 SourceRange nodeRange = rangeNode(node); 828 SourceRange nodeRange = rangeNode(node);
828 result.addVariable(variableElement, nodeRange); 829 result.addVariable(variableElement, nodeRange);
829 } 830 }
830 } 831 }
831 } 832 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698