| 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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine.source; | 8 library engine.source; |
| 9 | 9 |
| 10 import "dart:math" as math; | 10 import "dart:math" as math; |
| (...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 * | 617 * |
| 618 * @param localSourcePredicate the predicate to determine is [Source] is local | 618 * @param localSourcePredicate the predicate to determine is [Source] is local |
| 619 */ | 619 */ |
| 620 void set localSourcePredicate(LocalSourcePredicate localSourcePredicate) { | 620 void set localSourcePredicate(LocalSourcePredicate localSourcePredicate) { |
| 621 this._localSourcePredicate = localSourcePredicate; | 621 this._localSourcePredicate = localSourcePredicate; |
| 622 } | 622 } |
| 623 | 623 |
| 624 /// A table mapping package names to paths of directories containing | 624 /// A table mapping package names to paths of directories containing |
| 625 /// the package (or [null] if there is no registered package URI resolver). | 625 /// the package (or [null] if there is no registered package URI resolver). |
| 626 Map<String, List<Folder>> get packageMap { | 626 Map<String, List<Folder>> get packageMap { |
| 627 PackageMapUriResolver resolver = | 627 PackageMapUriResolver resolver = _resolvers.firstWhere( |
| 628 _resolvers.firstWhere((r) => r is PackageMapUriResolver, orElse: () => n
ull); | 628 (r) => r is PackageMapUriResolver, orElse: () => null); |
| 629 return resolver != null ? resolver.packageMap : null; | 629 return resolver != null ? resolver.packageMap : null; |
| 630 } | 630 } |
| 631 | 631 |
| 632 /** | 632 /** |
| 633 * Return a source object representing the given absolute URI, or `null` if th
e URI is not a | 633 * Return a source object representing the given absolute URI, or `null` if th
e URI is not a |
| 634 * valid URI or if it is not an absolute URI. | 634 * valid URI or if it is not an absolute URI. |
| 635 * | 635 * |
| 636 * @param absoluteUri the absolute URI to be resolved | 636 * @param absoluteUri the absolute URI to be resolved |
| 637 * @return a source object representing the absolute URI | 637 * @return a source object representing the absolute URI |
| 638 */ | 638 */ |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 674 * Return a source object that is equal to the source object used to obtain th
e given encoding. | 674 * Return a source object that is equal to the source object used to obtain th
e given encoding. |
| 675 * | 675 * |
| 676 * @param encoding the encoding of a source object | 676 * @param encoding the encoding of a source object |
| 677 * @return a source object that is described by the given encoding | 677 * @return a source object that is described by the given encoding |
| 678 * @throws IllegalArgumentException if the argument is not a valid encoding | 678 * @throws IllegalArgumentException if the argument is not a valid encoding |
| 679 * See [Source.encoding]. | 679 * See [Source.encoding]. |
| 680 */ | 680 */ |
| 681 Source fromEncoding(String encoding) { | 681 Source fromEncoding(String encoding) { |
| 682 Source source = forUri(encoding); | 682 Source source = forUri(encoding); |
| 683 if (source == null) { | 683 if (source == null) { |
| 684 throw new IllegalArgumentException("Invalid source encoding: '$encoding'")
; | 684 throw new IllegalArgumentException( |
| 685 "Invalid source encoding: '$encoding'"); |
| 685 } | 686 } |
| 686 return source; | 687 return source; |
| 687 } | 688 } |
| 688 | 689 |
| 689 /** | 690 /** |
| 690 * Determines if the given [Source] is local. | 691 * Determines if the given [Source] is local. |
| 691 * | 692 * |
| 692 * @param source the [Source] to analyze | 693 * @param source the [Source] to analyze |
| 693 * @return `true` if the given [Source] is local | 694 * @return `true` if the given [Source] is local |
| 694 */ | 695 */ |
| 695 bool isLocalSource(Source source) => _localSourcePredicate.isLocal(source); | 696 bool isLocalSource(Source source) => _localSourcePredicate.isLocal(source); |
| 696 | 697 |
| 697 /** | 698 /** |
| 698 * Return a source object representing the URI that results from resolving the
given (possibly | 699 * Return a source object representing the URI that results from resolving the
given (possibly |
| 699 * relative) contained URI against the URI associated with an existing source
object, whether or | 700 * relative) contained URI against the URI associated with an existing source
object, whether or |
| 700 * not the resulting source exists, or `null` if either the contained URI is i
nvalid or if | 701 * not the resulting source exists, or `null` if either the contained URI is i
nvalid or if |
| 701 * it cannot be resolved against the source object's URI. | 702 * it cannot be resolved against the source object's URI. |
| 702 * | 703 * |
| 703 * @param containingSource the source containing the given URI | 704 * @param containingSource the source containing the given URI |
| 704 * @param containedUri the (possibly relative) URI to be resolved against the
containing source | 705 * @param containedUri the (possibly relative) URI to be resolved against the
containing source |
| 705 * @return the source representing the contained URI | 706 * @return the source representing the contained URI |
| 706 */ | 707 */ |
| 707 Source resolveUri(Source containingSource, String containedUri) { | 708 Source resolveUri(Source containingSource, String containedUri) { |
| 708 if (containedUri == null || containedUri.isEmpty) { | 709 if (containedUri == null || containedUri.isEmpty) { |
| 709 return null; | 710 return null; |
| 710 } | 711 } |
| 711 try { | 712 try { |
| 712 // Force the creation of an escaped URI to deal with spaces, etc. | 713 // Force the creation of an escaped URI to deal with spaces, etc. |
| 713 return _internalResolveUri( | 714 return _internalResolveUri( |
| 714 containingSource, | 715 containingSource, parseUriWithException(containedUri)); |
| 715 parseUriWithException(containedUri)); | |
| 716 } catch (exception, stackTrace) { | 716 } catch (exception, stackTrace) { |
| 717 String containingFullName = | 717 String containingFullName = |
| 718 containingSource != null ? containingSource.fullName : '<null>'; | 718 containingSource != null ? containingSource.fullName : '<null>'; |
| 719 AnalysisEngine.instance.logger.logError( | 719 AnalysisEngine.instance.logger.logError( |
| 720 "Could not resolve URI ($containedUri) relative to source ($containing
FullName)", | 720 "Could not resolve URI ($containedUri) relative to source ($containing
FullName)", |
| 721 new CaughtException(exception, stackTrace)); | 721 new CaughtException(exception, stackTrace)); |
| 722 return null; | 722 return null; |
| 723 } | 723 } |
| 724 } | 724 } |
| 725 | 725 |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1003 | 1003 |
| 1004 /** | 1004 /** |
| 1005 * Return an absolute URI that represents the given source, or `null` if a val
id URI cannot | 1005 * Return an absolute URI that represents the given source, or `null` if a val
id URI cannot |
| 1006 * be computed. | 1006 * be computed. |
| 1007 * | 1007 * |
| 1008 * @param source the source to get URI for | 1008 * @param source the source to get URI for |
| 1009 * @return the absolute URI representing the given source | 1009 * @return the absolute URI representing the given source |
| 1010 */ | 1010 */ |
| 1011 Uri restoreAbsolute(Source source) => null; | 1011 Uri restoreAbsolute(Source source) => null; |
| 1012 } | 1012 } |
| OLD | NEW |