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

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

Issue 835093005: Check if the method / accessor being inlined is synthetic. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/refactoring/inline_method_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 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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 AstNode node = new NodeLocator.con1(offset).searchWithin(unit); 336 AstNode node = new NodeLocator.con1(offset).searchWithin(unit);
337 if (node is! SimpleIdentifier) { 337 if (node is! SimpleIdentifier) {
338 return fatalStatus; 338 return fatalStatus;
339 } 339 }
340 SimpleIdentifier identifier = node as SimpleIdentifier; 340 SimpleIdentifier identifier = node as SimpleIdentifier;
341 // prepare selected ExecutableElement 341 // prepare selected ExecutableElement
342 Element element = identifier.bestElement; 342 Element element = identifier.bestElement;
343 if (element is! ExecutableElement) { 343 if (element is! ExecutableElement) {
344 return fatalStatus; 344 return fatalStatus;
345 } 345 }
346 if (element.isSynthetic) {
347 return fatalStatus;
348 }
346 _methodElement = element as ExecutableElement; 349 _methodElement = element as ExecutableElement;
347 _isAccessor = element is PropertyAccessorElement; 350 _isAccessor = element is PropertyAccessorElement;
348 _methodUnit = element.unit; 351 _methodUnit = element.unit;
349 _methodUtils = new CorrectionUtils(_methodUnit); 352 _methodUtils = new CorrectionUtils(_methodUnit);
350 // class member 353 // class member
351 bool isClassMember = element.enclosingElement is ClassElement; 354 bool isClassMember = element.enclosingElement is ClassElement;
352 if (element is MethodElement || _isAccessor && isClassMember) { 355 if (element is MethodElement || _isAccessor && isClassMember) {
353 MethodDeclaration methodDeclaration = element.node; 356 MethodDeclaration methodDeclaration = element.node;
354 _methodNode = methodDeclaration; 357 _methodNode = methodDeclaration;
355 _methodParameters = methodDeclaration.parameters; 358 _methodParameters = methodDeclaration.parameters;
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 } 840 }
838 841
839 void _addVariable(SimpleIdentifier node) { 842 void _addVariable(SimpleIdentifier node) {
840 VariableElement variableElement = getLocalVariableElement(node); 843 VariableElement variableElement = getLocalVariableElement(node);
841 if (variableElement != null) { 844 if (variableElement != null) {
842 SourceRange nodeRange = rangeNode(node); 845 SourceRange nodeRange = rangeNode(node);
843 result.addVariable(variableElement, nodeRange); 846 result.addVariable(variableElement, nodeRange);
844 } 847 }
845 } 848 }
846 } 849 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/refactoring/inline_method_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698