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

Unified Diff: frog/leg/lib/constant_map.dart

Issue 9873021: Move frog/leg to lib/compiler/implementation. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 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 | « frog/leg/lib/clock.dart ('k') | frog/leg/lib/core.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: frog/leg/lib/constant_map.dart
===================================================================
--- frog/leg/lib/constant_map.dart (revision 5925)
+++ frog/leg/lib/constant_map.dart (working copy)
@@ -1,50 +0,0 @@
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// This class has no constructor. This is on purpose since the instantiation
-// is shortcut by the compiler.
-class ConstantMap<V> implements Map<String, V> {
- final int length;
- // A constant map is backed by a JavaScript object.
- final _jsObject;
- final List<String> _keys;
-
- bool containsValue(V needle) {
- return getValues().some((V value) => value == needle);
- }
-
- bool containsKey(String key) {
- if (key == '__proto__') return false;
- return jsHasOwnProperty(_jsObject, key);
- }
-
- V operator [](String key) {
- if (!containsKey(key)) return null;
- return jsPropertyAccess(_jsObject, key);
- }
-
- void forEach(void f(String key, V value)) {
- _keys.forEach((String key) => f(key, this[key]));
- }
-
- Collection<String> getKeys() => _keys;
-
- Collection<V> getValues() {
- List<V> result = <V>[];
- _keys.forEach((String key) => result.add(this[key]));
- return result;
- }
-
- bool isEmpty() => length == 0;
-
- String toString() => Maps.mapToString(this);
-
- _throwImmutable() {
- throw const IllegalAccessException();
- }
- void operator []=(String key, V val) => _throwImmutable();
- V putIfAbsent(String key, V ifAbsent()) => _throwImmutable();
- V remove(String key) => _throwImmutable();
- void clear() => _throwImmutable();
-}
« no previous file with comments | « frog/leg/lib/clock.dart ('k') | frog/leg/lib/core.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698