Fixed tests
This commit is contained in:
parent
5302f635ac
commit
1ccc78e3a2
3 changed files with 9 additions and 11 deletions
|
@ -22,8 +22,8 @@ class _Alt<T> extends Parser<T> {
|
||||||
return result.successful
|
return result.successful
|
||||||
? result
|
? result
|
||||||
: result.addErrors([
|
: result.addErrors([
|
||||||
new SyntaxError(severity ?? SyntaxErrorSeverity.error, errorMessage,
|
new SyntaxError(
|
||||||
result.span ?? args.scanner.emptySpan),
|
severity, errorMessage, result.span ?? args.scanner.emptySpan),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -192,8 +192,8 @@ class WildcardSegment extends RouteSegment {
|
||||||
var items = r.value!.cast<RouteResult>();
|
var items = r.value!.cast<RouteResult>();
|
||||||
var a = items[0], b = items[1];
|
var a = items[0], b = items[1];
|
||||||
return a
|
return a
|
||||||
..addAll(b?.params ?? {})
|
..addAll(b.params ?? {})
|
||||||
.._setTail(b?.tail);
|
.._setTail(b.tail);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,9 +26,9 @@ class RoutingResult<T> {
|
||||||
|
|
||||||
/// The [RoutingResult] that matched the most specific sub-path.
|
/// The [RoutingResult] that matched the most specific sub-path.
|
||||||
RoutingResult<T> get deepest {
|
RoutingResult<T> get deepest {
|
||||||
RoutingResult<T> search = this;
|
var search = this;
|
||||||
|
|
||||||
while (search?.nested?.isNotEmpty == true) {
|
while (search.nested?.isNotEmpty == true) {
|
||||||
search = search.nested!.first;
|
search = search.nested!.first;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,9 +43,7 @@ class RoutingResult<T> {
|
||||||
|
|
||||||
/// The handlers at this sub-path.
|
/// The handlers at this sub-path.
|
||||||
List<T> get handlers {
|
List<T> get handlers {
|
||||||
return <T>[]
|
return <T>[...shallowRouter!.middleware, ...shallowRoute!.handlers!];
|
||||||
..addAll(shallowRouter!.middleware)
|
|
||||||
..addAll(shallowRoute!.handlers!);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// All handlers on this sub-path and its children.
|
/// All handlers on this sub-path and its children.
|
||||||
|
@ -69,7 +67,7 @@ class RoutingResult<T> {
|
||||||
|
|
||||||
/// All parameters on this sub-path and its children.
|
/// All parameters on this sub-path and its children.
|
||||||
Map<String?, dynamic> get allParams {
|
Map<String?, dynamic> get allParams {
|
||||||
final Map<String?, dynamic> params = {};
|
final params = <String?, dynamic>{};
|
||||||
|
|
||||||
void crawl(RoutingResult result) {
|
void crawl(RoutingResult result) {
|
||||||
params.addAll(result.params);
|
params.addAll(result.params);
|
||||||
|
@ -92,6 +90,6 @@ class RoutingResult<T> {
|
||||||
this.shallowRoute,
|
this.shallowRoute,
|
||||||
this.shallowRouter,
|
this.shallowRouter,
|
||||||
required this.tail}) {
|
required this.tail}) {
|
||||||
this.params.addAll(params ?? {});
|
this.params.addAll(params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue