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

Side by Side Diff: pkg/analyzer/lib/file_system/file_system.dart

Issue 1245263002: Actual URI support for package URI resolution. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Merge master (tk2). Created 5 years, 5 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
« no previous file with comments | « pkg/analyzer/CHANGELOG.md ('k') | pkg/analyzer/lib/source/package_map_resolver.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 file_system; 5 library file_system;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analyzer/src/generated/source.dart'; 9 import 'package:analyzer/src/generated/source.dart';
10 import 'package:path/path.dart'; 10 import 'package:path/path.dart';
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 /** 174 /**
175 * The name of the `file` scheme. 175 * The name of the `file` scheme.
176 */ 176 */
177 static String _FILE_SCHEME = "file"; 177 static String _FILE_SCHEME = "file";
178 178
179 final ResourceProvider _provider; 179 final ResourceProvider _provider;
180 180
181 ResourceUriResolver(this._provider); 181 ResourceUriResolver(this._provider);
182 182
183 @override 183 @override
184 Source resolveAbsolute(Uri uri) { 184 Source resolveAbsolute(Uri uri, [Uri actualUri]) {
185 if (!_isFileUri(uri)) { 185 if (!_isFileUri(uri)) {
186 return null; 186 return null;
187 } 187 }
188 Resource resource = 188 Resource resource =
189 _provider.getResource(_provider.pathContext.fromUri(uri)); 189 _provider.getResource(_provider.pathContext.fromUri(uri));
190 if (resource is File) { 190 if (resource is File) {
191 return resource.createSource(uri); 191 return resource.createSource(uri);
192 } 192 }
193 return null; 193 return null;
194 } 194 }
195 195
196 @override 196 @override
197 Uri restoreAbsolute(Source source) => source.uri; 197 Uri restoreAbsolute(Source source) => source.uri;
198 198
199 /** 199 /**
200 * Return `true` if the given [uri] is a `file` URI. 200 * Return `true` if the given [uri] is a `file` URI.
201 */ 201 */
202 static bool _isFileUri(Uri uri) => uri.scheme == _FILE_SCHEME; 202 static bool _isFileUri(Uri uri) => uri.scheme == _FILE_SCHEME;
203 } 203 }
OLDNEW
« no previous file with comments | « pkg/analyzer/CHANGELOG.md ('k') | pkg/analyzer/lib/source/package_map_resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698