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

Unified Diff: runtime/bin/builtin.dart

Issue 10103031: Refactor URI processing of native extensions directive #import("dart-ext:foo"). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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 | « no previous file | runtime/bin/extensions.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/builtin.dart
diff --git a/runtime/bin/builtin.dart b/runtime/bin/builtin.dart
index b61314748d2e6c80b82e200c9952a9a3884a3b07..4b458b6d1a989f565292735804b1306b87619361 100644
--- a/runtime/bin/builtin.dart
+++ b/runtime/bin/builtin.dart
@@ -67,37 +67,35 @@ String _resolveScriptUri(String cwd, String scriptName, bool windows) {
String _resolveUri(String base, String userString) {
var baseUri = new Uri.fromString(base);
_logResolution("# Resolving: $userString from $base");
- var resolved = baseUri.resolve(userString);
- _logResolution("# Resolved to: $resolved");
- return resolved.toString();
-}
-String _resolveExtensionUri(String base, String userString) {
+ // Relative URIs with scheme dart-ext should be resolved as if with no scheme.
var uri = new Uri.fromString(userString);
- if ("dart-ext" != uri.scheme) {
- throw "Not a Dart extension uri: $uri";
+ var resolved;
+ if ('dart-ext' == uri.scheme) {
+ resolved = baseUri.resolve(uri.path);
+ resolved = new Uri(scheme: "dart-ext", path: resolved.path);
+ // resolved.scheme = 'foo'; // Causes a segfault. Verify this is expected.
Ivan Posva 2012/04/17 18:50:06 Since the bug is filed now, you can remove this co
Bill Hesse 2012/04/18 09:56:39 This line will be removed. A separate bug and rep
+ } else {
+ resolved = baseUri.resolve(userString);
}
- var schemelessUri = new Uri(path: uri.path);
- var baseUri = new Uri.fromString(base);
- _logResolution("# Resolving: $userString from $base");
- var resolved = baseUri.resolveUri(schemelessUri);
- resolved = new Uri(scheme: 'dart-ext', path: resolved.path);
_logResolution("# Resolved to: $resolved");
return resolved.toString();
}
+
String _filePathFromUri(String userUri) {
var uri = new Uri.fromString(userUri);
_logResolution("# Getting file path from: $uri");
var path;
switch (uri.scheme) {
- case 'file': path = _filePathFromFileUri(uri); break;
+ case 'file':
+ case 'dart-ext': path = _filePathFromFileUri(uri); break;
Ivan Posva 2012/04/17 18:50:06 Since dart-ext is not a file URI I am expecting th
Bill Hesse 2012/04/18 09:56:39 Fixed by calling _filePathFromOtherUri. I wrote c
case 'package': path = _filePathFromPackageUri(uri); break;
default:
- // Only handling file and package URIs in standalone binary.
- _logResolution("# Not a file or package URI.");
+ // Only handling file, dart-ext and package URIs in standalone binary.
+ _logResolution("# Not a file, dart-ext, or package URI.");
throw "Not a known scheme: $uri";
}
« no previous file with comments | « no previous file | runtime/bin/extensions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698