OLD | NEW |
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 engine.source; | 5 library engine.source; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 import "dart:math" as math; | 8 import "dart:math" as math; |
9 | 9 |
10 import 'package:analyzer/file_system/file_system.dart'; | 10 import 'package:analyzer/file_system/file_system.dart'; |
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
661 return packageMap; | 661 return packageMap; |
662 } | 662 } |
663 | 663 |
664 // Default to the PackageMapUriResolver. | 664 // Default to the PackageMapUriResolver. |
665 PackageMapUriResolver resolver = _resolvers | 665 PackageMapUriResolver resolver = _resolvers |
666 .firstWhere((r) => r is PackageMapUriResolver, orElse: () => null); | 666 .firstWhere((r) => r is PackageMapUriResolver, orElse: () => null); |
667 return resolver != null ? resolver.packageMap : null; | 667 return resolver != null ? resolver.packageMap : null; |
668 } | 668 } |
669 | 669 |
670 /** | 670 /** |
| 671 * Return a source factory that will resolve URI's in the same way that this |
| 672 * source factory does. |
| 673 */ |
| 674 SourceFactory clone() { |
| 675 SourceFactory factory = |
| 676 new SourceFactory(_resolvers, _packages, _resourceProvider); |
| 677 factory.localSourcePredicate = _localSourcePredicate; |
| 678 return factory; |
| 679 } |
| 680 |
| 681 /** |
671 * Return a source object representing the given absolute URI, or `null` if th
e URI is not a | 682 * Return a source object representing the given absolute URI, or `null` if th
e URI is not a |
672 * valid URI or if it is not an absolute URI. | 683 * valid URI or if it is not an absolute URI. |
673 * | 684 * |
674 * @param absoluteUri the absolute URI to be resolved | 685 * @param absoluteUri the absolute URI to be resolved |
675 * @return a source object representing the absolute URI | 686 * @return a source object representing the absolute URI |
676 */ | 687 */ |
677 Source forUri(String absoluteUri) { | 688 Source forUri(String absoluteUri) { |
678 try { | 689 try { |
679 Uri uri = parseUriWithException(absoluteUri); | 690 Uri uri = parseUriWithException(absoluteUri); |
680 if (uri.isAbsolute) { | 691 if (uri.isAbsolute) { |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1088 Source resolveAbsolute(Uri uri, [Uri actualUri]); | 1099 Source resolveAbsolute(Uri uri, [Uri actualUri]); |
1089 | 1100 |
1090 /** | 1101 /** |
1091 * Return an absolute URI that represents the given [source], or `null` if a | 1102 * Return an absolute URI that represents the given [source], or `null` if a |
1092 * valid URI cannot be computed. | 1103 * valid URI cannot be computed. |
1093 * | 1104 * |
1094 * The computation should be based solely on [source.fullName]. | 1105 * The computation should be based solely on [source.fullName]. |
1095 */ | 1106 */ |
1096 Uri restoreAbsolute(Source source) => null; | 1107 Uri restoreAbsolute(Source source) => null; |
1097 } | 1108 } |
OLD | NEW |