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

Unified Diff: runtime/lib/expando_patch.dart

Issue 10870064: Use patching for Expando so the implementation-specific files are not needed in the SDK. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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: runtime/lib/expando_patch.dart
diff --git a/runtime/lib/expando_impl.dart b/runtime/lib/expando_patch.dart
similarity index 70%
rename from runtime/lib/expando_impl.dart
rename to runtime/lib/expando_patch.dart
index 6b19366a6bd3d4592e12638a0b67f6e4a8740ee0..964c1bf4fe7ecfbe14f226745c055c986f3b0e0f 100644
--- a/runtime/lib/expando_impl.dart
+++ b/runtime/lib/expando_patch.dart
@@ -2,14 +2,10 @@
// 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.
-class _Expando<T> implements Expando<T> {
- final String name;
-
- const _Expando([String this.name]);
-
- T operator[](Object object) {
- checkType(object);
- var weakProperty = find(this);
+patch class ExpandoImplementation<T> {
+ /* patch */ T operator[](Object object) {
+ _checkType(object);
+ var weakProperty = _find(this);
var list = weakProperty.value;
var doCompact = false;
var result = null;
@@ -30,9 +26,9 @@ class _Expando<T> implements Expando<T> {
return result;
}
- void operator[]=(Object object, T value) {
- checkType(object);
- var weakProperty = find(this);
+ /* patch */ void operator[]=(Object object, T value) {
+ _checkType(object);
+ var weakProperty = _find(this);
var list = weakProperty.value;
var doCompact = false;
int i = 0;
@@ -59,9 +55,7 @@ class _Expando<T> implements Expando<T> {
}
}
- String toString() => "Expando:$name";
-
- static checkType(object) {
+ static _checkType(object) {
if (object === null) {
throw new NullPointerException();
}
@@ -70,29 +64,29 @@ class _Expando<T> implements Expando<T> {
}
}
- static find(expando) {
- if (data === null) data = new List();
+ static _find(expando) {
+ if (_data === null) _data = new List();
var doCompact = false;
int i = 0;
- for (; i < data.length; ++i) {
- var key = data[i].key;
+ for (; i < _data.length; ++i) {
+ var key = _data[i].key;
if (key == expando) {
break;
}
if (key === null) {
doCompact = true;
- data[i] = null;
+ _data[i] = null;
}
}
- if (i == data.length) {
- data.add(new _WeakProperty(expando, new List()));
+ if (i == _data.length) {
+ _data.add(new _WeakProperty(expando, new List()));
}
- var result = data[i];
+ var result = _data[i];
if (doCompact) {
- data = data.filter((e) => (e !== null));
+ _data = _data.filter((e) => (e !== null));
}
return result;
}
- static List data;
+ static List _data;
}

Powered by Google App Engine
This is Rietveld 408576698