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

Unified Diff: pkg/analysis_server/lib/src/services/refactoring/move_file.dart

Issue 583193005: Integration of MOVE_FILE into the server and a couple of fixes. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analysis_server/lib/src/protocol.dart ('k') | pkg/analysis_server/test/edit/refactoring_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/services/refactoring/move_file.dart
diff --git a/pkg/analysis_server/lib/src/services/refactoring/move_file.dart b/pkg/analysis_server/lib/src/services/refactoring/move_file.dart
index b0ee6a66859783d7dec83c6a29f5e3c531044933..e22d79f64bc7af7f2c8f3125b1110e20650437a2 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/move_file.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/move_file.dart
@@ -98,7 +98,7 @@ class MoveFileRefactoringImpl extends RefactoringImpl implements
void _updateUriReference(UriReferencedElement element) {
if (!element.isSynthetic) {
String elementUri = element.uri;
- if (pathos.isRelative(elementUri)) {
+ if (_isRelativeUri(elementUri)) {
String elementPath = pathos.join(oldLibraryDir, elementUri);
String newUri = pathos.relative(elementPath, from: newLibraryDir);
int uriOffset = element.uriOffset;
@@ -115,4 +115,24 @@ class MoveFileRefactoringImpl extends RefactoringImpl implements
_updateUriReference(element);
}
}
+
+ /**
+ * Checks if the given [path] represents a relative URI.
+ *
+ * The following URI's are not relative:
+ * `/absolute/path/file.dart`
+ * `dart:math`
+ */
+ static bool _isRelativeUri(String path) {
+ // absolute path
+ if (pathos.isAbsolute(path)) {
+ return false;
+ }
+ // absolute URI
+ if (Uri.parse(path).isAbsolute) {
+ return false;
+ }
+ // OK
+ return true;
+ }
}
« no previous file with comments | « pkg/analysis_server/lib/src/protocol.dart ('k') | pkg/analysis_server/test/edit/refactoring_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698