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

Unified Diff: sdk/lib/io/platform.dart

Issue 1307183002: Add access to the isolate package-root/package-map in Platform. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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: sdk/lib/io/platform.dart
diff --git a/sdk/lib/io/platform.dart b/sdk/lib/io/platform.dart
index 56ddea0193b0df98b43e703e0c98828f4eb1e696..a365158b7fc54fda862cbc891e703a1a69e7036c 100644
--- a/sdk/lib/io/platform.dart
+++ b/sdk/lib/io/platform.dart
@@ -185,6 +185,29 @@ class Platform {
static String get packageRoot => _Platform.packageRoot;
/**
+ * Returns the package root of the current isolate, if any.
+ *
+ * If the isolate is using a [packageMap], this getter returns `null`,
Ivan Posva 2015/08/26 04:29:36 This is not entirely correct: An isolate might not
Lasse Reichstein Nielsen 2015/08/26 06:26:06 Again, I'm trying to keep things simpler by saying
+ * otherwise it returns the package root - a directory that package
+ * URIs are resolved against.
nweiz 2015/08/25 01:17:05 It would be good to explicitly mention how this di
Lasse Reichstein Nielsen 2015/08/25 06:23:00 Acknowledged.
Ivan Posva 2015/08/26 04:29:36 If we decide to remove packageRoot, then we do not
Lasse Reichstein Nielsen 2015/08/26 06:26:06 Acknowledged.
+ */
+ static Uri get packageRootUri => _Platform.packageRootUri;
Ivan Posva 2015/08/26 04:29:35 All the new getters here need to return Futures. T
Lasse Reichstein Nielsen 2015/08/26 06:26:06 Would it be possible to be blocking instead of asy
+
+ /**
+ * Returns the package mapping of the current isolate, if any.
floitsch 2015/08/24 15:09:45 Should we mention that the package-mapping (as wel
Lasse Reichstein Nielsen 2015/08/25 06:23:00 Acknowledged.
+ *
+ * If the current isolate is using [packageRoot], this getter returns `null`.
nweiz 2015/08/25 01:17:05 Shouldn't this be [packageRootUri]? Presumably thi
Lasse Reichstein Nielsen 2015/08/25 06:23:00 Good catch. I'm not sure if a default package root
+ *
+ * The package map maps package names to a directory that package URIs for
+ * that package are resolved against, or to `null`, if the package name is
floitsch 2015/08/24 15:09:45 no need to specify the `null` case. That's the nor
Lasse Reichstein Nielsen 2015/08/25 06:23:00 True. Should just say that it only has keys for a
+ * not recognized.
+ *
+ * Returns an empty map if the isolate does not have a way to resolve package
+ * URIs.
Ivan Posva 2015/08/25 04:50:39 Should return null if the isolate is not using a p
Lasse Reichstein Nielsen 2015/08/25 06:23:00 I chose to do this instead because it's more usefu
Ivan Posva 2015/08/26 04:29:35 Isn't that exactly what the null-aware operators w
Lasse Reichstein Nielsen 2015/08/26 06:26:06 That would be an argument if ?[] was actually in t
+ */
+ static Map<String, Uri> get packageMap => _Platform.packageMap;
+
+ /**
* Returns the version of the current Dart runtime.
*
* The returned `String` is formatted as the

Powered by Google App Engine
This is Rietveld 408576698