| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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.context.source; | 5 library analyzer.src.context.source; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/file_system/file_system.dart'; | 9 import 'package:analyzer/file_system/file_system.dart'; |
| 10 import 'package:analyzer/file_system/physical_file_system.dart'; | 10 import 'package:analyzer/file_system/physical_file_system.dart'; |
| 11 import 'package:analyzer/source/package_map_resolver.dart'; | 11 import 'package:analyzer/source/package_map_resolver.dart'; |
| 12 import 'package:analyzer/src/generated/engine.dart'; | 12 import 'package:analyzer/src/generated/engine.dart'; |
| 13 import 'package:analyzer/src/generated/java_core.dart'; | |
| 14 import 'package:analyzer/src/generated/java_engine.dart'; | 13 import 'package:analyzer/src/generated/java_engine.dart'; |
| 15 import 'package:analyzer/src/generated/sdk.dart'; | 14 import 'package:analyzer/src/generated/sdk.dart'; |
| 16 import 'package:analyzer/src/generated/source.dart'; | 15 import 'package:analyzer/src/generated/source.dart'; |
| 17 import 'package:analyzer/src/generated/utilities_dart.dart' as utils; | 16 import 'package:analyzer/src/generated/utilities_dart.dart' as utils; |
| 18 import 'package:analyzer/src/util/fast_uri.dart'; | 17 import 'package:analyzer/src/util/fast_uri.dart'; |
| 19 import 'package:package_config/packages.dart'; | 18 import 'package:package_config/packages.dart'; |
| 20 | 19 |
| 21 /** | 20 /** |
| 22 * Instances of the class `SourceFactory` resolve possibly relative URI's | 21 * Instances of the class `SourceFactory` resolve possibly relative URI's |
| 23 * against an existing [Source]. | 22 * against an existing [Source]. |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 bool isLocalSource(Source source) => _localSourcePredicate.isLocal(source); | 151 bool isLocalSource(Source source) => _localSourcePredicate.isLocal(source); |
| 153 | 152 |
| 154 @override | 153 @override |
| 155 Source resolveUri(Source containingSource, String containedUri) { | 154 Source resolveUri(Source containingSource, String containedUri) { |
| 156 if (containedUri == null || containedUri.isEmpty) { | 155 if (containedUri == null || containedUri.isEmpty) { |
| 157 return null; | 156 return null; |
| 158 } | 157 } |
| 159 try { | 158 try { |
| 160 // Force the creation of an escaped URI to deal with spaces, etc. | 159 // Force the creation of an escaped URI to deal with spaces, etc. |
| 161 return _internalResolveUri(containingSource, FastUri.parse(containedUri)); | 160 return _internalResolveUri(containingSource, FastUri.parse(containedUri)); |
| 162 } on URISyntaxException { | 161 } on FormatException { |
| 163 return null; | 162 return null; |
| 164 } catch (exception, stackTrace) { | 163 } catch (exception, stackTrace) { |
| 165 String containingFullName = | 164 String containingFullName = |
| 166 containingSource != null ? containingSource.fullName : '<null>'; | 165 containingSource != null ? containingSource.fullName : '<null>'; |
| 167 AnalysisEngine.instance.logger.logInformation( | 166 AnalysisEngine.instance.logger.logInformation( |
| 168 "Could not resolve URI ($containedUri) " | 167 "Could not resolve URI ($containedUri) " |
| 169 "relative to source ($containingFullName)", | 168 "relative to source ($containingFullName)", |
| 170 new CaughtException(exception, stackTrace)); | 169 new CaughtException(exception, stackTrace)); |
| 171 return null; | 170 return null; |
| 172 } | 171 } |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 for (UriResolver resolver in resolvers) { | 259 for (UriResolver resolver in resolvers) { |
| 261 Source result = resolver.resolveAbsolute(containedUri, actualUri); | 260 Source result = resolver.resolveAbsolute(containedUri, actualUri); |
| 262 if (result != null) { | 261 if (result != null) { |
| 263 return result; | 262 return result; |
| 264 } | 263 } |
| 265 } | 264 } |
| 266 return null; | 265 return null; |
| 267 }); | 266 }); |
| 268 } | 267 } |
| 269 } | 268 } |
| OLD | NEW |