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

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

Issue 10850015: Changed default Uri constructor to Uri.fromComponents(), new default constructor is Uri.fromString(… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « dart/lib/uri/uri.dart ('k') | dart/tests/compiler/dart2js/compiler_helper.dart » ('j') | no next file with comments »
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 void print(arg) { 8 void print(arg) {
9 _Logger._printString(arg.toString()); 9 _Logger._printString(arg.toString());
10 } 10 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 cwd = "/${cwd.replaceAll('\\', '/')}"; 57 cwd = "/${cwd.replaceAll('\\', '/')}";
58 _logResolution("## cwd: $cwd"); 58 _logResolution("## cwd: $cwd");
59 if ((scriptName.length > 2) && (scriptName[1] == ":")) { 59 if ((scriptName.length > 2) && (scriptName[1] == ":")) {
60 // This is an absolute path. 60 // This is an absolute path.
61 scriptName = "/${scriptName.replaceAll('\\', '/')}"; 61 scriptName = "/${scriptName.replaceAll('\\', '/')}";
62 } else { 62 } else {
63 scriptName = scriptName.replaceAll('\\', '/'); 63 scriptName = scriptName.replaceAll('\\', '/');
64 } 64 }
65 _logResolution("## scriptName: $scriptName"); 65 _logResolution("## scriptName: $scriptName");
66 } 66 }
67 var base = new Uri(scheme: "file", path: cwd.endsWith("/") ? cwd : "$cwd/"); 67 var base =
68 new Uri.fromComponents(
69 scheme: "file",
70 path: cwd.endsWith("/") ? cwd : "$cwd/");
68 _entrypoint = base.resolve(scriptName); 71 _entrypoint = base.resolve(scriptName);
69 _logResolution("# Resolved script to: $_entrypoint"); 72 _logResolution("# Resolved script to: $_entrypoint");
70 73
71 return _entrypoint.toString(); 74 return _entrypoint.toString();
72 } 75 }
73 76
74 String _resolveUri(String base, String userString) { 77 String _resolveUri(String base, String userString) {
75 var baseUri = new Uri.fromString(base); 78 var baseUri = new Uri.fromString(base);
76 _logResolution("# Resolving: $userString from $base"); 79 _logResolution("# Resolving: $userString from $base");
77 80
78 // Relative URIs with scheme dart-ext should be resolved as if with no scheme. 81 // Relative URIs with scheme dart-ext should be resolved as if with no scheme.
79 var uri = new Uri.fromString(userString); 82 var uri = new Uri.fromString(userString);
80 var resolved; 83 var resolved;
81 if ('dart-ext' == uri.scheme) { 84 if ('dart-ext' == uri.scheme) {
82 resolved = baseUri.resolve(uri.path); 85 resolved = baseUri.resolve(uri.path);
83 resolved = new Uri(scheme: "dart-ext", path: resolved.path); 86 resolved = new Uri.fromComponents(scheme: "dart-ext", path: resolved.path);
84 } else { 87 } else {
85 resolved = baseUri.resolve(userString); 88 resolved = baseUri.resolve(userString);
86 } 89 }
87 _logResolution("# Resolved to: $resolved"); 90 _logResolution("# Resolved to: $resolved");
88 return resolved.toString(); 91 return resolved.toString();
89 } 92 }
90 93
91 94
92 String _filePathFromUri(String userUri, bool isWindows) { 95 String _filePathFromUri(String userUri, bool isWindows) {
93 var uri = new Uri.fromString(userUri); 96 var uri = new Uri.fromString(userUri);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 var path; 156 var path;
154 if (_packageRoot !== null) { 157 if (_packageRoot !== null) {
155 path = "${_packageRoot}${uri.path}"; 158 path = "${_packageRoot}${uri.path}";
156 } else { 159 } else {
157 path = _entrypoint.resolve('packages/${uri.path}').path; 160 path = _entrypoint.resolve('packages/${uri.path}').path;
158 } 161 }
159 162
160 _logResolution("# Package: $path"); 163 _logResolution("# Package: $path");
161 return path; 164 return path;
162 } 165 }
OLDNEW
« no previous file with comments | « dart/lib/uri/uri.dart ('k') | dart/tests/compiler/dart2js/compiler_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698