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

Unified Diff: lib/src/utils.dart

Issue 1126713002: fixes #130, accept anything with `iterator` in for loops (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: fix iterator Created 5 years, 8 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
« lib/src/codegen/js_codegen.dart ('K') | « lib/src/codegen/js_codegen.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/utils.dart
diff --git a/lib/src/utils.dart b/lib/src/utils.dart
index 1837b684905de08f9bc3d8d553f417043b11477d..12a5081f1c85e761625f4464b5c1d45e26560852 100644
--- a/lib/src/utils.dart
+++ b/lib/src/utils.dart
@@ -424,3 +424,16 @@ Map<String, DartType> getObjectMemberMap(TypeProvider typeProvider) {
}
return map;
}
+
+/// Searches all supertype, in order of most derived members, to see if any
+/// [match] a condition. If so, returns the first match, otherwise returns null.
+InterfaceType findSupertype(InterfaceType type, bool match(InterfaceType t)) {
+ for (var m in type.mixins.reversed) {
+ if (match(m)) return m;
+ }
+ var s = type.superclass;
+ if (s == null) return null;
+
+ if (match(s)) return type;
+ return findSupertype(s, match);
+}
« lib/src/codegen/js_codegen.dart ('K') | « lib/src/codegen/js_codegen.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698