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

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

Issue 2393813003: Add BazelWorkspace and move BazelFileUriResolver to it. (Closed)
Patch Set: Created 4 years, 2 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
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 analyzer.file_system.file_system; 5 library analyzer.file_system.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:analyzer/src/util/absolute_path.dart'; 10 import 'package:analyzer/src/util/absolute_path.dart';
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 253
254 ResourceUriResolver(this._provider); 254 ResourceUriResolver(this._provider);
255 255
256 ResourceProvider get provider => _provider; 256 ResourceProvider get provider => _provider;
257 257
258 @override 258 @override
259 Source resolveAbsolute(Uri uri, [Uri actualUri]) { 259 Source resolveAbsolute(Uri uri, [Uri actualUri]) {
260 if (!isFileUri(uri)) { 260 if (!isFileUri(uri)) {
261 return null; 261 return null;
262 } 262 }
263 Resource resource = 263 String path = _provider.pathContext.fromUri(uri);
264 _provider.getResource(_provider.pathContext.fromUri(uri)); 264 Resource resource = _provider.getResource(path);
265 if (resource is File) { 265 if (resource is File) {
266 return resource.createSource(actualUri ?? uri); 266 return resource.createSource(actualUri ?? uri);
267 } 267 }
268 return null; 268 return null;
269 } 269 }
270 270
271 @override 271 @override
272 Uri restoreAbsolute(Source source) => 272 Uri restoreAbsolute(Source source) =>
273 _provider.pathContext.toUri(source.fullName); 273 _provider.pathContext.toUri(source.fullName);
274 274
275 /** 275 /**
276 * Return `true` if the given [uri] is a `file` URI. 276 * Return `true` if the given [uri] is a `file` URI.
277 */ 277 */
278 static bool isFileUri(Uri uri) => uri.scheme == FILE_SCHEME; 278 static bool isFileUri(Uri uri) => uri.scheme == FILE_SCHEME;
279 } 279 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/bazel.dart » ('j') | pkg/analyzer/test/generated/bazel_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698