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

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

Issue 309803003: Avoid using RegExps in path to work around issue 19090. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 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
Index: pkg/path/lib/src/context.dart
diff --git a/pkg/path/lib/src/context.dart b/pkg/path/lib/src/context.dart
index f3826d78c6c307fe23c84184aea9f22e7b7751f2..a62c6a142fa0b2e6e978154f04e8aba87a801bdb 100644
--- a/pkg/path/lib/src/context.dart
+++ b/pkg/path/lib/src/context.dart
@@ -219,7 +219,7 @@ class Context {
// replaces the path after it.
var parsed = _parse(part);
parsed.root = this.rootPrefix(buffer.toString());
- if (parsed.root.contains(style.needsSeparatorPattern)) {
+ if (style.needsSeparator(parsed.root)) {
parsed.separators[0] = style.separator;
}
buffer.clear();
@@ -230,7 +230,7 @@ class Context {
buffer.clear();
buffer.write(part);
} else {
- if (part.length > 0 && part[0].contains(style.separatorPattern)) {
+ if (part.length > 0 && style.separators.any(part[0].contains)) {
Bob Nystrom 2014/06/02 22:43:05 How about making this a method too: style.contain
nweiz 2014/06/02 23:13:25 Done.
// The part starts with a separator, so we don't need to add one.
} else if (needsSeparator) {
buffer.write(separator);
@@ -241,7 +241,7 @@ class Context {
// Unless this part ends with a separator, we'll need to add one before
// the next part.
- needsSeparator = part.contains(style.needsSeparatorPattern);
+ needsSeparator = style.needsSeparator(part);
}
return buffer.toString();

Powered by Google App Engine
This is Rietveld 408576698