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

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

Issue 569723004: Issue 19801. Fix for inlining referenced function with an expression body. (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.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.dart' hide Element; 9 import 'package:analysis_server/src/protocol.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';
11 import 'package:analysis_server/src/services/correction/status.dart'; 11 import 'package:analysis_server/src/services/correction/status.dart';
12 import 'package:analysis_server/src/services/correction/strings.dart';
12 import 'package:analysis_server/src/services/correction/util.dart'; 13 import 'package:analysis_server/src/services/correction/util.dart';
13 import 'package:analysis_server/src/services/refactoring/refactoring.dart'; 14 import 'package:analysis_server/src/services/refactoring/refactoring.dart';
14 import 'package:analysis_server/src/services/refactoring/refactoring_internal.da rt'; 15 import 'package:analysis_server/src/services/refactoring/refactoring_internal.da rt';
15 import 'package:analysis_server/src/services/search/element_visitors.dart'; 16 import 'package:analysis_server/src/services/search/element_visitors.dart';
16 import 'package:analysis_server/src/services/search/hierarchy.dart'; 17 import 'package:analysis_server/src/services/search/hierarchy.dart';
17 import 'package:analysis_server/src/services/search/search_engine.dart'; 18 import 'package:analysis_server/src/services/search/search_engine.dart';
18 import 'package:analyzer/src/generated/ast.dart'; 19 import 'package:analyzer/src/generated/ast.dart';
19 import 'package:analyzer/src/generated/element.dart'; 20 import 'package:analyzer/src/generated/element.dart';
20 import 'package:analyzer/src/generated/source.dart'; 21 import 'package:analyzer/src/generated/source.dart';
21 22
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 // not invocation, just reference to function 589 // not invocation, just reference to function
589 String source; 590 String source;
590 { 591 {
591 source = ref._methodUtils.getRangeText( 592 source = ref._methodUtils.getRangeText(
592 rangeStartEnd(ref._methodParameters.leftParenthesis, ref._methodNode )); 593 rangeStartEnd(ref._methodParameters.leftParenthesis, ref._methodNode ));
593 String methodPrefix = 594 String methodPrefix =
594 ref._methodUtils.getLinePrefix(ref._methodNode.offset); 595 ref._methodUtils.getLinePrefix(ref._methodNode.offset);
595 source = 596 source =
596 _refUtils.replaceSourceIndent(source, methodPrefix, _refPrefix); 597 _refUtils.replaceSourceIndent(source, methodPrefix, _refPrefix);
597 source = source.trim(); 598 source = source.trim();
599 source = removeEnd(source, ';');
598 } 600 }
599 // do insert 601 // do insert
600 SourceRange range = rangeNode(_node); 602 SourceRange range = rangeNode(_node);
601 SourceEdit edit = new SourceEdit.range(range, source); 603 SourceEdit edit = new SourceEdit.range(range, source);
602 ref.change.addEdit(_refFile, edit); 604 ref.change.addEdit(_refFile, edit);
603 } 605 }
604 } 606 }
605 607
606 bool _shouldProcess() { 608 bool _shouldProcess() {
607 if (!ref.inlineAll) { 609 if (!ref.inlineAll) {
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 } 795 }
794 796
795 void _addVariable(SimpleIdentifier node) { 797 void _addVariable(SimpleIdentifier node) {
796 VariableElement variableElement = getLocalVariableElement(node); 798 VariableElement variableElement = getLocalVariableElement(node);
797 if (variableElement != null) { 799 if (variableElement != null) {
798 SourceRange nodeRange = rangeNode(node); 800 SourceRange nodeRange = rangeNode(node);
799 result.addVariable(variableElement, nodeRange); 801 result.addVariable(variableElement, nodeRange);
800 } 802 }
801 } 803 }
802 } 804 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698