OLD | NEW |
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.move_file; | 5 library services.src.refactoring.move_file; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:core' hide Resource; | 8 import 'dart:core' hide Resource; |
9 | 9 |
10 import 'package:analysis_server/src/protocol_server.dart' hide Element; | 10 import 'package:analysis_server/src/protocol_server.dart' hide Element; |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 if (library == null) { | 165 if (library == null) { |
166 continue; | 166 continue; |
167 } | 167 } |
168 // update all imports | 168 // update all imports |
169 updateUriElements(List<UriReferencedElement> uriElements) { | 169 updateUriElements(List<UriReferencedElement> uriElements) { |
170 for (UriReferencedElement element in uriElements) { | 170 for (UriReferencedElement element in uriElements) { |
171 String uri = element.uri; | 171 String uri = element.uri; |
172 if (uri != null) { | 172 if (uri != null) { |
173 String oldPrefix = 'package:$oldPackageName/'; | 173 String oldPrefix = 'package:$oldPackageName/'; |
174 if (uri.startsWith(oldPrefix)) { | 174 if (uri.startsWith(oldPrefix)) { |
175 doSourceChange_addElementEdit(change, library, new SourceEdit( | 175 doSourceChange_addElementEdit( |
176 element.uriOffset + 1, oldPrefix.length, | 176 change, |
177 'package:$newPackageName/')); | 177 library, |
| 178 new SourceEdit(element.uriOffset + 1, oldPrefix.length, |
| 179 'package:$newPackageName/')); |
178 } | 180 } |
179 } | 181 } |
180 } | 182 } |
181 } | 183 } |
182 updateUriElements(library.imports); | 184 updateUriElements(library.imports); |
183 updateUriElements(library.exports); | 185 updateUriElements(library.exports); |
184 } | 186 } |
185 // done | 187 // done |
186 return change; | 188 return change; |
187 } | 189 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 } | 234 } |
233 } | 235 } |
234 } | 236 } |
235 | 237 |
236 void _updateUriReferences(List<UriReferencedElement> elements) { | 238 void _updateUriReferences(List<UriReferencedElement> elements) { |
237 for (UriReferencedElement element in elements) { | 239 for (UriReferencedElement element in elements) { |
238 _updateUriReference(element); | 240 _updateUriReference(element); |
239 } | 241 } |
240 } | 242 } |
241 } | 243 } |
OLD | NEW |