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

Unified Diff: compiler/java/com/google/dart/compiler/SystemLibraryManager.java

Issue 10391092: Update analysis server and indexer (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
Index: compiler/java/com/google/dart/compiler/SystemLibraryManager.java
===================================================================
--- compiler/java/com/google/dart/compiler/SystemLibraryManager.java (revision 7590)
+++ compiler/java/com/google/dart/compiler/SystemLibraryManager.java (working copy)
@@ -20,6 +20,7 @@
import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
+import java.util.Set;
/**
* Manages the collection of {@link SystemLibrary}s.
@@ -138,6 +139,29 @@
throw new InternalCompilerException("Failed to open " + file);
}
}
+
+ /**
+ * Given an absolute file URI (e.g. "file:/some/install/directory/dart-sdk/lib/core/bool.dart"),
+ * answer the corresponding dart: URI (e.g. "dart://core/bool.dart") for that file URI,
+ * or <code>null</code> if the file URI does not map to a dart: URI
+ * @param fileUri the file URI
+ * @return the dart URI or <code>null</code>
+ */
+ public URI getRelativeUri(URI fileUri) {
Brian Wilkerson 2012/05/14 14:19:58 I don't have source available, but I seem to recal
danrubel 2012/05/16 04:26:36 "getDartUri" would be a better name given it's cur
+ // TODO (danrubel): does not convert dart: libraries outside the dart-sdk/lib directory
Brian Wilkerson 2012/05/14 14:19:58 This implies that libraries outside the SDK *shoul
danrubel 2012/05/16 04:26:36 Agreed. The "config" can be modified to point to
+ if (fileUri == null || !fileUri.getScheme().equals("file")) {
Brian Wilkerson 2012/05/14 14:19:58 nit: seems like there must be a constant for this
+ return null;
+ }
+ URI relativeUri = sdkLibPathUri.relativize(fileUri);
+ if (relativeUri.getScheme() == null) {
+ try {
+ return new URI(null, null, "dart://" + relativeUri.getPath(), null);
+ } catch (URISyntaxException e) {
+ //$FALL-THROUGH$
+ }
+ }
+ return null;
+ }
/**
* Answer the original "dart:<libname>" URI for the specified resolved URI or <code>null</code> if

Powered by Google App Engine
This is Rietveld 408576698