| 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 import 'dart:math' show min; | 8 import 'dart:math' show min; |
| 9 | 9 |
| 10 import 'package:analyzer/exception/exception.dart'; | 10 import 'package:analyzer/exception/exception.dart'; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 return packageMap; | 95 return packageMap; |
| 96 } | 96 } |
| 97 | 97 |
| 98 // Default to the PackageMapUriResolver. | 98 // Default to the PackageMapUriResolver. |
| 99 PackageMapUriResolver resolver = resolvers | 99 PackageMapUriResolver resolver = resolvers |
| 100 .firstWhere((r) => r is PackageMapUriResolver, orElse: () => null); | 100 .firstWhere((r) => r is PackageMapUriResolver, orElse: () => null); |
| 101 return resolver?.packageMap; | 101 return resolver?.packageMap; |
| 102 } | 102 } |
| 103 | 103 |
| 104 @override | 104 @override |
| 105 // Alternately, we could check the pubspec for "sdk: flutter" |
| 106 bool get hasFlutterDependency => packageMap.containsKey('flutter'); |
| 107 |
| 108 @override |
| 105 SourceFactory clone() { | 109 SourceFactory clone() { |
| 106 SourceFactory factory = | 110 SourceFactory factory = |
| 107 new SourceFactory(resolvers, _packages, _resourceProvider); | 111 new SourceFactory(resolvers, _packages, _resourceProvider); |
| 108 factory.localSourcePredicate = _localSourcePredicate; | 112 factory.localSourcePredicate = _localSourcePredicate; |
| 109 return factory; | 113 return factory; |
| 110 } | 114 } |
| 111 | 115 |
| 112 @override | 116 @override |
| 113 Source forUri(String absoluteUri) { | 117 Source forUri(String absoluteUri) { |
| 114 try { | 118 try { |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 for (UriResolver resolver in resolvers) { | 264 for (UriResolver resolver in resolvers) { |
| 261 Source result = resolver.resolveAbsolute(containedUri, actualUri); | 265 Source result = resolver.resolveAbsolute(containedUri, actualUri); |
| 262 if (result != null) { | 266 if (result != null) { |
| 263 return result; | 267 return result; |
| 264 } | 268 } |
| 265 } | 269 } |
| 266 return null; | 270 return null; |
| 267 }); | 271 }); |
| 268 } | 272 } |
| 269 } | 273 } |
| OLD | NEW |