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

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

Issue 1159563004: Rename Element.node (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/services/refactoring/convert_method_to_getter.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.convert_getter_to_getter; 5 library services.src.refactoring.convert_getter_to_getter;
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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 return new RefactoringStatus.fatal( 78 return new RefactoringStatus.fatal(
79 'Only explicit getters can be converted to methods.'); 79 'Only explicit getters can be converted to methods.');
80 } 80 }
81 return new RefactoringStatus(); 81 return new RefactoringStatus();
82 } 82 }
83 83
84 void _updateElementDeclaration(PropertyAccessorElement element) { 84 void _updateElementDeclaration(PropertyAccessorElement element) {
85 // prepare "get" keyword 85 // prepare "get" keyword
86 Token getKeyword = null; 86 Token getKeyword = null;
87 { 87 {
88 AstNode node = element.node; 88 AstNode node = element.computeNode();
89 if (node is MethodDeclaration) { 89 if (node is MethodDeclaration) {
90 getKeyword = node.propertyKeyword; 90 getKeyword = node.propertyKeyword;
91 } else if (node is FunctionDeclaration) { 91 } else if (node is FunctionDeclaration) {
92 getKeyword = node.propertyKeyword; 92 getKeyword = node.propertyKeyword;
93 } 93 }
94 } 94 }
95 // remove "get " 95 // remove "get "
96 if (getKeyword != null) { 96 if (getKeyword != null) {
97 SourceRange getRange = rangeStartEnd(getKeyword, element.nameOffset); 97 SourceRange getRange = rangeStartEnd(getKeyword, element.nameOffset);
98 SourceEdit edit = newSourceEdit_range(getRange, ''); 98 SourceEdit edit = newSourceEdit_range(getRange, '');
(...skipping 11 matching lines...) Expand all
110 List<SourceReference> references = getSourceReferences(matches); 110 List<SourceReference> references = getSourceReferences(matches);
111 for (SourceReference reference in references) { 111 for (SourceReference reference in references) {
112 Element refElement = reference.element; 112 Element refElement = reference.element;
113 SourceRange refRange = reference.range; 113 SourceRange refRange = reference.range;
114 // insert "()" 114 // insert "()"
115 var edit = new SourceEdit(refRange.end, 0, "()"); 115 var edit = new SourceEdit(refRange.end, 0, "()");
116 doSourceChange_addElementEdit(change, refElement, edit); 116 doSourceChange_addElementEdit(change, refElement, edit);
117 } 117 }
118 } 118 }
119 } 119 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/services/refactoring/convert_method_to_getter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698