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

Side by Side 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, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine.source; 8 library engine.source;
9 9
10 import "dart:math" as math; 10 import "dart:math" as math;
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 * 598 *
599 * @param localSourcePredicate the predicate to determine is [Source] is local 599 * @param localSourcePredicate the predicate to determine is [Source] is local
600 */ 600 */
601 void set localSourcePredicate(LocalSourcePredicate localSourcePredicate) { 601 void set localSourcePredicate(LocalSourcePredicate localSourcePredicate) {
602 this._localSourcePredicate = localSourcePredicate; 602 this._localSourcePredicate = localSourcePredicate;
603 } 603 }
604 604
605 /// A table mapping package names to paths of directories containing 605 /// A table mapping package names to paths of directories containing
606 /// the package (or [null] if there is no registered package URI resolver). 606 /// the package (or [null] if there is no registered package URI resolver).
607 Map<String, List<Folder>> get packageMap { 607 Map<String, List<Folder>> get packageMap {
608 PackageMapUriResolver resolver = 608 for(UriResolver r in _resolvers) {
609 _resolvers.firstWhere((r) => r is PackageMapUriResolver, orElse: null); 609 if(r is PackageMapUriResolver) {
Paul Berry 2015/02/02 23:15:25 Nit: why not just use: orElse: () => null
pquitslund 2015/02/02 23:19:39 This! :)
pquitslund 2015/02/02 23:19:12 Run the formatter? The should (at least) be a spa
610 return resolver != null ? resolver.packageMap : null; 610 return r.packageMap;
611 }
612 }
613 return null;
611 } 614 }
612 615
613 /** 616 /**
614 * Return a source object representing the given absolute URI, or `null` if th e URI is not a 617 * Return a source object representing the given absolute URI, or `null` if th e URI is not a
615 * valid URI or if it is not an absolute URI. 618 * valid URI or if it is not an absolute URI.
616 * 619 *
617 * @param absoluteUri the absolute URI to be resolved 620 * @param absoluteUri the absolute URI to be resolved
618 * @return a source object representing the absolute URI 621 * @return a source object representing the absolute URI
619 */ 622 */
620 Source forUri(String absoluteUri) { 623 Source forUri(String absoluteUri) {
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
984 987
985 /** 988 /**
986 * Return an absolute URI that represents the given source, or `null` if a val id URI cannot 989 * Return an absolute URI that represents the given source, or `null` if a val id URI cannot
987 * be computed. 990 * be computed.
988 * 991 *
989 * @param source the source to get URI for 992 * @param source the source to get URI for
990 * @return the absolute URI representing the given source 993 * @return the absolute URI representing the given source
991 */ 994 */
992 Uri restoreAbsolute(Source source) => null; 995 Uri restoreAbsolute(Source source) => null;
993 } 996 }
OLDNEW
« 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