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

Unified Diff: utils/pub/path.dart

Issue 11609005: Fix analyzer errors/warnings for Pub. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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
Index: utils/pub/path.dart
diff --git a/utils/pub/path.dart b/utils/pub/path.dart
index 593396d0b83490de1be419a829c36ac0b09b715a..109a926e5736eee727220793833b95afb2756b05 100644
--- a/utils/pub/path.dart
+++ b/utils/pub/path.dart
@@ -294,7 +294,7 @@ class Builder {
buffer.clear();
buffer.add(part);
} else {
- if (part.length > 0 && style.separatorPattern.hasMatch(part[0])) {
+ if (part.length > 0 && part[0].contains(style.separatorPattern)) {
Bob Nystrom 2012/12/18 19:40:35 A simpler fix here is to just make separatorPatter
nweiz 2012/12/19 01:10:21 I think using str.contains(pattern) is about as cl
// The part starts with a separator, so we don't need to add one.
} else if (needsSeparator) {
buffer.add(separator);
@@ -306,7 +306,7 @@ class Builder {
// Unless this part ends with a separator, we'll need to add one before
// the next part.
needsSeparator = part.length > 0 &&
- !style.separatorPattern.hasMatch(part[part.length - 1]);
+ !part[part.length - 1].contains(style.separatorPattern);
}
return buffer.toString();
@@ -524,9 +524,9 @@ class Style {
/// Gets the root prefix of [path] if path is absolute. If [path] is relative,
/// returns `null`.
String getRoot(String path) {
- var match = _rootPattern.firstMatch(path);
- if (match == null) return null;
- return match[0];
+ var matches = _rootPattern.allMatches(path).iterator();
+ if (!matches.hasNext) return null;
+ return matches.next()[0];
}
String toString() => name;
« utils/pub/http.dart ('K') | « utils/pub/http.dart ('k') | utils/pub/source.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698