| Index: third_party/pkg/route_hierarchical/lib/url_pattern.dart
|
| diff --git a/third_party/pkg/route_hierarchical/lib/url_pattern.dart b/third_party/pkg/route_hierarchical/lib/url_pattern.dart
|
| index ade9e9405465b40f4ffe9cb6604488dbcdb8401b..ee465f9bd642357fd6e41942c66c6d5c9b47a727 100644
|
| --- a/third_party/pkg/route_hierarchical/lib/url_pattern.dart
|
| +++ b/third_party/pkg/route_hierarchical/lib/url_pattern.dart
|
| @@ -53,7 +53,7 @@ UrlPattern urlPattern(String p) => new UrlPattern(p);
|
| * server.addRequestHandler(matchesUrl(articleUrl), serveArticle);
|
| * }
|
| *
|
| - * serveArticle(req, res) {
|
| + * serveArcticle(req, res) {
|
| * var articleId = articleUrl.parse(req.path)[0];
|
| * // ...
|
| * }
|
| @@ -94,14 +94,15 @@ class UrlPattern implements UrlMatcher, Pattern {
|
|
|
| String reverse(Iterable args, {bool useFragment: false}) {
|
| var sb = new StringBuffer();
|
| + var chars = pattern.split('');
|
| var argsIter = args.iterator;
|
|
|
| int depth = 0;
|
| int groupCount = 0;
|
| bool escaped = false;
|
|
|
| - for (int i = 0; i < pattern.length; i++) {
|
| - var c = pattern[i];
|
| + for (int i = 0; i < chars.length; i++) {
|
| + var c = chars[i];
|
| if (c == '\\' && escaped == false) {
|
| escaped = true;
|
| } else {
|
| @@ -197,10 +198,17 @@ class UrlPattern implements UrlMatcher, Pattern {
|
| * fragment to the server, so the server will have to handle just the path
|
| * part.
|
| */
|
| - bool matchesNonFragment(String str) =>
|
| - _hasFragment ? _matches(_baseRegex, str) : matches(str);
|
| + bool matchesNonFragment(String str) {
|
| + if (!_hasFragment) {
|
| + return matches(str);
|
| + } else {
|
| + return _matches(_baseRegex, str);
|
| + }
|
| + }
|
|
|
| - Iterable<Match> allMatches(String str) => regex.allMatches(str);
|
| + Iterable<Match> allMatches(String str) {
|
| + return regex.allMatches(str);
|
| + }
|
|
|
| bool operator ==(other) =>
|
| (other is UrlPattern) && (other.pattern == pattern);
|
| @@ -272,6 +280,7 @@ class UrlPattern implements UrlMatcher, Pattern {
|
| sb.write(c);
|
| }
|
| }
|
| +// sb.write(r'$');
|
| _regex = new RegExp(sb.toString());
|
| }
|
|
|
|
|