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 analyzer.src.generated.source; | 5 library analyzer.src.generated.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 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 827 throw new AnalysisException( | 827 throw new AnalysisException( |
| 828 "Cannot resolve a relative URI without a containing source: $contain edUri"); | 828 "Cannot resolve a relative URI without a containing source: $contain edUri"); |
| 829 } | 829 } |
| 830 containedUri = containingSource.resolveRelativeUri(containedUri); | 830 containedUri = containingSource.resolveRelativeUri(containedUri); |
| 831 } | 831 } |
| 832 | 832 |
| 833 Uri actualUri = containedUri; | 833 Uri actualUri = containedUri; |
| 834 | 834 |
| 835 // Check .packages and update target and actual URIs as appropriate. | 835 // Check .packages and update target and actual URIs as appropriate. |
| 836 if (_packages != null && containedUri.scheme == 'package') { | 836 if (_packages != null && containedUri.scheme == 'package') { |
| 837 Uri packageUri = | 837 Uri packageUri = null; |
| 838 _packages.resolve(containedUri, notFound: (Uri packageUri) => null); | 838 try { |
| 839 packageUri = | |
| 840 _packages.resolve(containedUri, notFound: (Uri packageUri) => null); | |
| 841 } on ArgumentError { | |
| 842 // Fall through to try resolvers. | |
| 843 } | |
| 839 | 844 |
| 840 if (packageUri != null) { | 845 if (packageUri != null) { |
|
Brian Wilkerson
2016/01/09 16:02:39
This 'if' ought to be inside the 'try' because pac
skybrian
2016/01/09 19:26:45
That's true but it seems like it would be less cle
Brian Wilkerson
2016/01/10 16:55:25
I disagree (hence the comment), but it's your call
| |
| 841 // Ensure scheme is set. | 846 // Ensure scheme is set. |
| 842 if (packageUri.scheme == '') { | 847 if (packageUri.scheme == '') { |
| 843 packageUri = packageUri.replace(scheme: 'file'); | 848 packageUri = packageUri.replace(scheme: 'file'); |
| 844 } | 849 } |
| 845 containedUri = packageUri; | 850 containedUri = packageUri; |
| 846 } | 851 } |
| 847 } | 852 } |
| 848 | 853 |
| 849 for (UriResolver resolver in _resolvers) { | 854 for (UriResolver resolver in _resolvers) { |
| 850 Source result = resolver.resolveAbsolute(containedUri, actualUri); | 855 Source result = resolver.resolveAbsolute(containedUri, actualUri); |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1091 Source resolveAbsolute(Uri uri, [Uri actualUri]); | 1096 Source resolveAbsolute(Uri uri, [Uri actualUri]); |
| 1092 | 1097 |
| 1093 /** | 1098 /** |
| 1094 * Return an absolute URI that represents the given [source], or `null` if a | 1099 * Return an absolute URI that represents the given [source], or `null` if a |
| 1095 * valid URI cannot be computed. | 1100 * valid URI cannot be computed. |
| 1096 * | 1101 * |
| 1097 * The computation should be based solely on [source.fullName]. | 1102 * The computation should be based solely on [source.fullName]. |
| 1098 */ | 1103 */ |
| 1099 Uri restoreAbsolute(Source source) => null; | 1104 Uri restoreAbsolute(Source source) => null; |
| 1100 } | 1105 } |
| OLD | NEW |