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

Unified Diff: packages/matcher/lib/src/util.dart

Issue 3015713002: Roll to pickup pool changes
Patch Set: Created 3 years, 3 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 | « packages/matcher/lib/src/string_matchers.dart ('k') | packages/matcher/pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/matcher/lib/src/util.dart
diff --git a/packages/matcher/lib/src/util.dart b/packages/matcher/lib/src/util.dart
index 112819bd724d4d83424320cc10dd9615ded14834..7e7ff058c55d78886f03744ea46148343f193c9c 100644
--- a/packages/matcher/lib/src/util.dart
+++ b/packages/matcher/lib/src/util.dart
@@ -5,7 +5,7 @@
import 'core_matchers.dart';
import 'interfaces.dart';
-typedef bool _Predicate(value);
+typedef bool _Predicate<T>(T value);
/// A [Map] between whitespace characters and their escape sequences.
const _escapeMap = const {
@@ -38,8 +38,13 @@ void addStateInfo(Map matchState, Map values) {
Matcher wrapMatcher(x) {
if (x is Matcher) {
return x;
- } else if (x is _Predicate) {
+ } else if (x is _Predicate<Object>) {
+ // x is already a predicate that can handle anything
return predicate(x);
+ } else if (x is _Predicate<Null>) {
+ // x is a unary predicate, but expects a specific type
+ // so wrap it.
+ return predicate((a) => (x as dynamic)(a));
} else {
return equals(x);
}
« no previous file with comments | « packages/matcher/lib/src/string_matchers.dart ('k') | packages/matcher/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698