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

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

Issue 1831133005: Consolidate duplicate code for resloving URIs. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Sort Created 4 years, 9 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.memory_file_system; 5 library analyzer.file_system.memory_file_system;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 import 'dart:core' hide Resource; 9 import 'dart:core' hide Resource;
10 10
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 449
450 @override 450 @override
451 bool operator ==(other) { 451 bool operator ==(other) {
452 return other is _MemoryFileSource && other.id == id; 452 return other is _MemoryFileSource && other.id == id;
453 } 453 }
454 454
455 @override 455 @override
456 bool exists() => file.exists; 456 bool exists() => file.exists;
457 457
458 @override 458 @override
459 Uri resolveRelativeUri(Uri relativeUri) {
460 Uri baseUri = uri;
461 String scheme = uri.scheme;
462 if (scheme == DartUriResolver.DART_SCHEME) {
463 String libraryName = uri.path;
464 baseUri = Uri.parse('$scheme:$libraryName/$libraryName.dart');
465 }
466 return baseUri.resolveUri(relativeUri);
467 }
468
469 @override
470 String toString() => file.toString(); 459 String toString() => file.toString();
471 } 460 }
472 461
473 /** 462 /**
474 * An in-memory implementation of [Folder]. 463 * An in-memory implementation of [Folder].
475 */ 464 */
476 class _MemoryFolder extends _MemoryResource implements Folder { 465 class _MemoryFolder extends _MemoryResource implements Folder {
477 _MemoryFolder(MemoryResourceProvider provider, String path) 466 _MemoryFolder(MemoryResourceProvider provider, String path)
478 : super(provider, path); 467 : super(provider, path);
479 468
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 bool operator ==(other) { 570 bool operator ==(other) {
582 if (runtimeType != other.runtimeType) { 571 if (runtimeType != other.runtimeType) {
583 return false; 572 return false;
584 } 573 }
585 return path == other.path; 574 return path == other.path;
586 } 575 }
587 576
588 @override 577 @override
589 String toString() => path; 578 String toString() => path;
590 } 579 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/context/source.dart » ('j') | pkg/analyzer/test/generated/all_the_rest_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698