Index: lib/compiler/implementation/lib/mockimpl.dart |
diff --git a/lib/compiler/implementation/lib/mockimpl.dart b/lib/compiler/implementation/lib/mockimpl.dart |
index 08648b963210d8818313dab8ad876dd86f21a81e..d10ca5a15d489c3f1f3edf4dd590bab06c1e4b82 100644 |
--- a/lib/compiler/implementation/lib/mockimpl.dart |
+++ b/lib/compiler/implementation/lib/mockimpl.dart |
@@ -377,3 +377,27 @@ class ListFactory<E> { |
return result; |
} |
} |
+ |
+class ExpandoImplementation<T> implements Expando<T> { |
+ |
+ final String name; |
+ final String _key; |
+ |
+ ExpandoImplementation([this.name]) : _key = _generateKey(); |
+ |
+ T operator[](Object object) { |
+ return Primitives.getProperty(object, _key); |
+ } |
+ |
+ void operator[]=(Object object, T value) { |
+ Primitives.setProperty(object, _key, value); |
+ } |
+ |
+ String toString() { |
+ return (name === null) ? "Expando:${_key}" : "Expando:${name}@${_key}"; |
+ } |
+ |
+ static int _keyCount = 0; |
+ static String _generateKey() => "\$key\$${_keyCount++}"; |
+ |
+} |