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

Side by Side Diff: runtime/bin/builtin.dart

Issue 11308170: Deal with extension loading from packages. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/bin/extensions.cc » ('j') | runtime/bin/extensions.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 builtin; 5 library builtin;
6 import 'dart:uri'; 6 import 'dart:uri';
7 7
8 // Corelib 'print' implementation. 8 // Corelib 'print' implementation.
9 void _print(arg) { 9 void _print(arg) {
10 _Logger._printString(arg.toString()); 10 _Logger._printString(arg.toString());
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 _entrypoint = base.resolve(scriptName); 64 _entrypoint = base.resolve(scriptName);
65 _logResolution("# Resolved script to: $_entrypoint"); 65 _logResolution("# Resolved script to: $_entrypoint");
66 66
67 return _entrypoint.toString(); 67 return _entrypoint.toString();
68 } 68 }
69 69
70 String _resolveUri(String base, String userString) { 70 String _resolveUri(String base, String userString) {
71 var baseUri = new Uri.fromString(base); 71 var baseUri = new Uri.fromString(base);
72 _logResolution("# Resolving: $userString from $base"); 72 _logResolution("# Resolving: $userString from $base");
73 73
74 // Relative URIs with scheme dart-ext should be resolved as if with no scheme.
75 var uri = new Uri.fromString(userString); 74 var uri = new Uri.fromString(userString);
76 var resolved; 75 var resolved;
77 if ('dart-ext' == uri.scheme) { 76 if ('dart-ext' == uri.scheme) {
77 // Relative URIs with scheme dart-ext should be resolved as if with no
78 // scheme.
78 resolved = baseUri.resolve(uri.path); 79 resolved = baseUri.resolve(uri.path);
79 resolved = new Uri.fromComponents(scheme: "dart-ext", path: resolved.path); 80 var path = resolved.path;
81 if (resolved.scheme == 'package') {
82 // If we are resolving relative to a package URI we go directly to the
83 // file path and keep the dart-ext scheme. Otherwise, we will lose the
84 // package URI path part.
85 path = _filePathFromPackageUri(resolved);
86 }
87 resolved = new Uri.fromComponents(scheme: "dart-ext", path: path);
80 } else { 88 } else {
81 resolved = baseUri.resolve(userString); 89 resolved = baseUri.resolve(userString);
82 } 90 }
83 _logResolution("# Resolved to: $resolved"); 91 _logResolution("# Resolved to: $resolved");
84 return resolved.toString(); 92 return resolved.toString();
85 } 93 }
86 94
87 95
88 String _filePathFromUri(String userUri, bool isWindows) { 96 String _filePathFromUri(String userUri, bool isWindows) {
89 var uri = new Uri.fromString(userUri); 97 var uri = new Uri.fromString(userUri);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 var path; 157 var path;
150 if (_packageRoot != null) { 158 if (_packageRoot != null) {
151 path = "${_packageRoot}${uri.path}"; 159 path = "${_packageRoot}${uri.path}";
152 } else { 160 } else {
153 path = _entrypoint.resolve('packages/${uri.path}').path; 161 path = _entrypoint.resolve('packages/${uri.path}').path;
154 } 162 }
155 163
156 _logResolution("# Package: $path"); 164 _logResolution("# Package: $path");
157 return path; 165 return path;
158 } 166 }
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/extensions.cc » ('j') | runtime/bin/extensions.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698