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

Unified Diff: sdk/lib/_internal/compiler/implementation/mirrors/util.dart

Issue 258753004: Use UnmodifiableMapView in compiler (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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
Index: sdk/lib/_internal/compiler/implementation/mirrors/util.dart
diff --git a/sdk/lib/_internal/compiler/implementation/mirrors/util.dart b/sdk/lib/_internal/compiler/implementation/mirrors/util.dart
index 2ea4638c6b9d0647c5ab191bc3ce1e10f546e0fe..7f505dbdb30793961e6fa8283e424a4a4cd2dced 100644
--- a/sdk/lib/_internal/compiler/implementation/mirrors/util.dart
+++ b/sdk/lib/_internal/compiler/implementation/mirrors/util.dart
@@ -135,50 +135,3 @@ class FilteredImmutableMap<K, V> extends ImmutableMapWrapper<K, V> {
});
}
}
-
-/**
- * An [AsFilter] takes a [value] of type [V1] and returns [value] iff it is of
- * type [V2] or [:null:] otherwise. An [AsFilter] therefore behaves like the
- * [:as:] expression.
- */
-typedef V2 AsFilter<V1, V2>(V1 value);
-
-/**
- * An immutable map wrapper capable of filtering the input map based on types.
- * It takes an [AsFilter] function which converts the original values of type
- * [Vin] into values of type [Vout], or returns [:null:] if the value should
- * not be included in the filtered map.
- */
-class AsFilteredImmutableMap<K, Vin, Vout> extends AbstractMap<K, Vout> {
- final Map<K, Vin> _map;
- final AsFilter<Vin, Vout> _filter;
-
- AsFilteredImmutableMap(this._map, this._filter);
-
- int get length {
- var count = 0;
- forEach((k,v) {
- count++;
- });
- return count;
- }
-
- Vout operator [](K key) {
- if (key is K) {
- Vin value = _map[key];
- if (value != null) {
- return _filter(value);
- }
- }
- return null;
- }
-
- void forEach(void f(K key, Vout value)) {
- _map.forEach((K k, Vin v) {
- var value = _filter(v);
- if (value != null) {
- f(k, value);
- }
- });
- }
-}

Powered by Google App Engine
This is Rietveld 408576698