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

Unified Diff: pkg/path/lib/path.dart

Issue 19851005: Fix static warnings in pkg/path. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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/path/lib/path.dart
diff --git a/pkg/path/lib/path.dart b/pkg/path/lib/path.dart
index 3d533e101625621c83433590dafe51ce71eabb05..1845e096199cc6cb99fc597734be4ede16158d43 100644
--- a/pkg/path/lib/path.dart
+++ b/pkg/path/lib/path.dart
@@ -757,8 +757,8 @@ class Builder {
var parts = [];
var separators = [];
- var firstSeparator = style.separatorPattern.firstMatch(path);
- if (firstSeparator != null && firstSeparator.start == 0) {
+ var firstSeparator = style.separatorPattern.matchAsPrefix(path);
+ if (firstSeparator != null) {
separators.add(firstSeparator[0]);
path = path.substring(firstSeparator[0].length);
} else {
@@ -839,8 +839,9 @@ abstract 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 match[0];
+ // TODO(rnystrom): Use firstMatch() when #7080 is fixed.
+ var matches = rootPattern.allMatches(path);
+ if (matches.isNotEmpty) return matches.first[0];
return getRelativeRoot(path);
}
@@ -849,9 +850,10 @@ abstract class Style {
/// If [path] is relative or absolute and not root-relative, returns `null`.
String getRelativeRoot(String path) {
if (relativeRootPattern == null) return null;
- var match = relativeRootPattern.firstMatch(path);
- if (match == null) return null;
- return match[0];
+ // TODO(rnystrom): Use firstMatch() when #7080 is fixed.
+ var matches = relativeRootPattern.allMatches(path);
+ if (matches.isEmpty) return null;
+ return matches.first[0];
}
/// Returns the path represented by [uri] in this style.
« 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