Chromium Code Reviews| 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 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 732 | 732 |
| 733 /** | 733 /** |
| 734 * Determines if the given [Source] is local. | 734 * Determines if the given [Source] is local. |
| 735 * | 735 * |
| 736 * @param source the [Source] to analyze | 736 * @param source the [Source] to analyze |
| 737 * @return `true` if the given [Source] is local | 737 * @return `true` if the given [Source] is local |
| 738 */ | 738 */ |
| 739 bool isLocalSource(Source source) => _localSourcePredicate.isLocal(source); | 739 bool isLocalSource(Source source) => _localSourcePredicate.isLocal(source); |
| 740 | 740 |
| 741 /** | 741 /** |
| 742 * Return a source object representing the URI that results from resolving the given (possibly | 742 * Return a source representing the URI that results from resolving the given |
| 743 * relative) contained URI against the URI associated with an existing source object, whether or | 743 * (possibly relative) [containedUri] against the URI associated with the |
| 744 * not the resulting source exists, or `null` if either the contained URI is i nvalid or if | 744 * [containingSource], whether or not the resulting source exists, or `null` |
| 745 * it cannot be resolved against the source object's URI. | 745 * if either the [containedUri] is invalid or if it cannot be resolved against |
| 746 * | 746 * the [containingSource]'s URI. |
| 747 * @param containingSource the source containing the given URI | |
| 748 * @param containedUri the (possibly relative) URI to be resolved against the containing source | |
| 749 * @return the source representing the contained URI | |
| 750 */ | 747 */ |
| 751 Source resolveUri(Source containingSource, String containedUri) { | 748 Source resolveUri(Source containingSource, String containedUri) { |
| 752 if (containedUri == null || containedUri.isEmpty) { | 749 if (containedUri == null || containedUri.isEmpty) { |
| 753 return null; | 750 return null; |
| 754 } | 751 } |
| 755 try { | 752 try { |
| 756 // Force the creation of an escaped URI to deal with spaces, etc. | 753 // Force the creation of an escaped URI to deal with spaces, etc. |
| 757 return _internalResolveUri( | 754 return _internalResolveUri( |
| 758 containingSource, parseUriWithException(containedUri)); | 755 containingSource, parseUriWithException(containedUri)); |
| 756 } on URISyntaxException { | |
| 757 return null; | |
| 759 } catch (exception, stackTrace) { | 758 } catch (exception, stackTrace) { |
| 760 String containingFullName = | 759 String containingFullName = |
| 761 containingSource != null ? containingSource.fullName : '<null>'; | 760 containingSource != null ? containingSource.fullName : '<null>'; |
| 762 AnalysisEngine.instance.logger.logInformation( | 761 AnalysisEngine.instance.logger.logInformation( |
|
Brian Wilkerson
2015/12/08 19:37:13
The other option would be to never log information
| |
| 763 "Could not resolve URI ($containedUri) relative to source ($containing FullName)", | 762 "Could not resolve URI ($containedUri) relative to source ($containing FullName)", |
| 764 new CaughtException(exception, stackTrace)); | 763 new CaughtException(exception, stackTrace)); |
| 765 return null; | 764 return null; |
| 766 } | 765 } |
| 767 } | 766 } |
| 768 | 767 |
| 769 /** | 768 /** |
| 770 * Return an absolute URI that represents the given source, or `null` if a val id URI cannot | 769 * Return an absolute URI that represents the given source, or `null` if a val id URI cannot |
| 771 * be computed. | 770 * be computed. |
| 772 * | 771 * |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1093 Source resolveAbsolute(Uri uri, [Uri actualUri]); | 1092 Source resolveAbsolute(Uri uri, [Uri actualUri]); |
| 1094 | 1093 |
| 1095 /** | 1094 /** |
| 1096 * Return an absolute URI that represents the given [source], or `null` if a | 1095 * Return an absolute URI that represents the given [source], or `null` if a |
| 1097 * valid URI cannot be computed. | 1096 * valid URI cannot be computed. |
| 1098 * | 1097 * |
| 1099 * The computation should be based solely on [source.fullName]. | 1098 * The computation should be based solely on [source.fullName]. |
| 1100 */ | 1099 */ |
| 1101 Uri restoreAbsolute(Source source) => null; | 1100 Uri restoreAbsolute(Source source) => null; |
| 1102 } | 1101 } |
| OLD | NEW |