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

Unified Diff: pkg/smoke/lib/src/common.dart

Issue 180273004: Fixes in smoke, which in turn should fix todomvc. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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 | « pkg/smoke/lib/smoke.dart ('k') | pkg/smoke/lib/static.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/smoke/lib/src/common.dart
diff --git a/pkg/smoke/lib/src/common.dart b/pkg/smoke/lib/src/common.dart
index 379e0a3bbb9c03ab68c8b4ffc19438659cda50c2..2f0f9b4e18a8d62db440687b2015aef586575002 100644
--- a/pkg/smoke/lib/src/common.dart
+++ b/pkg/smoke/lib/src/common.dart
@@ -5,6 +5,8 @@
/// Some common utilities used by other libraries in this package.
library smoke.src.common;
+import 'package:smoke/smoke.dart' as smoke show isSubclassOf;
+
/// Returns [input] adjusted to be within [min] and [max] length. Truncating it
/// if it's longer, or padding it with nulls if it's shorter. The returned list
/// is a new copy if any modification is needed, otherwise [input] is returned.
@@ -23,8 +25,14 @@ List adjustList(List input, int min, int max) {
/// an annotation in [queryAnnotations] or whose type is listed in
/// [queryAnnotations].
bool matchesAnnotation(Iterable metadata, Iterable queryAnnotations) {
- return metadata.any((m) => queryAnnotations.contains(m) ||
- queryAnnotations.contains(m.runtimeType));
+ for (var meta in metadata) {
+ for (var queryMeta in queryAnnotations) {
+ if (meta == queryMeta) return true;
+ if (queryMeta is Type &&
+ smoke.isSubclassOf(meta.runtimeType, queryMeta)) return true;
+ }
+ }
+ return false;
}
/// Number of arguments supported by [minArgs] and [maxArgs].
« no previous file with comments | « pkg/smoke/lib/smoke.dart ('k') | pkg/smoke/lib/static.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698