Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Unified Diff: pkg/analyzer/lib/src/generated/source.dart

Issue 896623002: Don't use firstWhere as it throws an error if there is no such element (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/source.dart
diff --git a/pkg/analyzer/lib/src/generated/source.dart b/pkg/analyzer/lib/src/generated/source.dart
index 2a06746b459a078d21db0bfb5e46958279563283..bb23e6e43a1f9cc4f40d79a580fb8679b1e0b892 100644
--- a/pkg/analyzer/lib/src/generated/source.dart
+++ b/pkg/analyzer/lib/src/generated/source.dart
@@ -605,9 +605,12 @@ class SourceFactory {
/// A table mapping package names to paths of directories containing
/// the package (or [null] if there is no registered package URI resolver).
Map<String, List<Folder>> get packageMap {
- PackageMapUriResolver resolver =
- _resolvers.firstWhere((r) => r is PackageMapUriResolver, orElse: null);
Paul Berry 2015/02/02 23:15:25 Nit: why not just use: orElse: () => null
pquitslund 2015/02/02 23:19:39 This! :)
- return resolver != null ? resolver.packageMap : null;
+ for(UriResolver r in _resolvers) {
+ if(r is PackageMapUriResolver) {
pquitslund 2015/02/02 23:19:12 Run the formatter? The should (at least) be a spa
+ return r.packageMap;
+ }
+ }
+ return null;
}
/**
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698