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

Unified Diff: test/generated_sdk/lib/_internal/compiler/js_lib/constant_map.dart

Issue 1162723007: remove generated_sdk from checked in code (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 7 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: test/generated_sdk/lib/_internal/compiler/js_lib/constant_map.dart
diff --git a/test/generated_sdk/lib/_internal/compiler/js_lib/constant_map.dart b/test/generated_sdk/lib/_internal/compiler/js_lib/constant_map.dart
deleted file mode 100644
index 0d66acac104cfdd5fb1cf9e5bfa962ff26bf0a38..0000000000000000000000000000000000000000
--- a/test/generated_sdk/lib/_internal/compiler/js_lib/constant_map.dart
+++ /dev/null
@@ -1,147 +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.
-
-part of _js_helper;
-
-abstract class ConstantMap<K, V> implements Map<K, V> {
- const ConstantMap._();
-
- bool get isEmpty => length == 0;
-
- bool get isNotEmpty => !isEmpty;
-
- String toString() => Maps.mapToString(this);
-
- _throwUnmodifiable() {
- throw new UnsupportedError("Cannot modify unmodifiable Map");
- }
- void operator []=(K key, V val) => _throwUnmodifiable();
- V putIfAbsent(K key, V ifAbsent()) => _throwUnmodifiable();
- V remove(Object key) => _throwUnmodifiable();
- void clear() => _throwUnmodifiable();
- void addAll(Map<K, V> other) => _throwUnmodifiable();
-}
-
-class ConstantStringMap<K, V> extends ConstantMap<K, V>
- implements _symbol_dev.EfficientLength {
-
- // This constructor is not used. The instantiation is shortcut by the
- // compiler. It is here to make the uninitialized final fields legal.
- const ConstantStringMap._(this.length, this._jsObject, this._keys)
- : super._();
-
- final int length;
- // A constant map is backed by a JavaScript object.
- final _jsObject;
- final List<K> _keys;
-
- bool containsValue(Object needle) {
- return values.any((V value) => value == needle);
- }
-
- bool containsKey(Object key) {
- if (key is! String) return false;
- if ('__proto__' == key) return false;
- return jsHasOwnProperty(_jsObject, key);
- }
-
- V operator [](Object key) {
- if (!containsKey(key)) return null;
- return _fetch(key);
- }
-
- // [_fetch] is the indexer for keys for which `containsKey(key)` is true.
- _fetch(key) => jsPropertyAccess(_jsObject, key);
-
- void forEach(void f(K key, V value)) {
- // Use a JS 'cast' to get efficient loop. Type inferrence doesn't get this
- // since constant map representation is chosen after type inferrence and the
- // instantiation is shortcut by the compiler.
- var keys = JS('JSArray', '#', _keys);
- for (int i = 0; i < keys.length; i++) {
- var key = keys[i];
- f(key, _fetch(key));
- }
- }
-
- Iterable<K> get keys {
- return new _ConstantMapKeyIterable<K>(this);
- }
-
- Iterable<V> get values {
- return new MappedIterable<K, V>(_keys, (key) => _fetch(key));
- }
-}
-
-class ConstantProtoMap<K, V> extends ConstantStringMap<K, V> {
- // This constructor is not used. The instantiation is shortcut by the
- // compiler. It is here to make the uninitialized final fields legal.
- ConstantProtoMap._(length, jsObject, keys, this._protoValue)
- : super._(length, jsObject, keys);
-
- final V _protoValue;
-
- bool containsKey(Object key) {
- if (key is! String) return false;
- if ('__proto__' == key) return true;
- return jsHasOwnProperty(_jsObject, key);
- }
-
- _fetch(key) =>
- '__proto__' == key ? _protoValue : jsPropertyAccess(_jsObject, key);
-}
-
-class _ConstantMapKeyIterable<K> extends IterableBase<K> {
- ConstantStringMap<K, dynamic> _map;
- _ConstantMapKeyIterable(this._map);
-
- Iterator<K> get iterator => _map._keys.iterator;
-
- int get length => _map._keys.length;
-}
-
-class GeneralConstantMap<K, V> extends ConstantMap<K, V> {
- // This constructor is not used. The instantiation is shortcut by the
- // compiler. It is here to make the uninitialized final fields legal.
- GeneralConstantMap(this._jsData) : super._();
-
- // [_jsData] holds a key-value pair list.
- final _jsData;
-
- // We cannot create the backing map on creation since hashCode interceptors
- // have not been defined when constants are created.
- Map<K, V> _getMap() {
- if (JS('bool', r'!this.$map')) {
- Map backingMap = new LinkedHashMap<K, V>();
- JS('', r'this.$map = #', fillLiteralMap(_jsData, backingMap));
- }
- return JS('Map<K, V>', r'this.$map');
- }
-
- bool containsValue(Object needle) {
- return _getMap().containsValue(needle);
- }
-
- bool containsKey(Object key) {
- return _getMap().containsKey(key);
- }
-
- V operator [](Object key) {
- return _getMap()[key];
- }
-
- void forEach(void f(K key, V value)) {
- _getMap().forEach(f);
- }
-
- Iterable<K> get keys {
- return _getMap().keys;
- }
-
- Iterable<V> get values {
- return _getMap().values;
- }
-
- int get length => _getMap().length;
-}

Powered by Google App Engine
This is Rietveld 408576698