| Index: lib/compiler/implementation/lib/mock.dart
|
| diff --git a/lib/compiler/implementation/lib/mock.dart b/lib/compiler/implementation/lib/mock.dart
|
| index 7950f9d2df380d525e558aae2b1b8c0c1bcfdc1e..89e26be7fe34929bedd1de454fa3c135ea42d88c 100644
|
| --- a/lib/compiler/implementation/lib/mock.dart
|
| +++ b/lib/compiler/implementation/lib/mock.dart
|
| @@ -48,3 +48,43 @@ class _InternalByteArray {
|
| void exit(int exitCode) {
|
| throw new UnsupportedOperationException("exit($exitCode)");
|
| }
|
| +
|
| +class _Expando<T> implements Expando<T> {
|
| +
|
| + final String name;
|
| +
|
| + const _Expando([this.name]);
|
| +
|
| + T operator[](Object object) {
|
| + var values = Primitives.getProperty(object, EXPANDO_PROPERTY_NAME);
|
| + return (values === null) ? null : Primitives.getProperty(values, _getKey());
|
| + }
|
| +
|
| + void operator[]=(Object object, T value) {
|
| + var values = Primitives.getProperty(object, EXPANDO_PROPERTY_NAME);
|
| + if (values === null) {
|
| + values = new Object();
|
| + Primitives.setProperty(object, EXPANDO_PROPERTY_NAME, values);
|
| + }
|
| + Primitives.setProperty(values, _getKey(), value);
|
| + }
|
| +
|
| + String toString() {
|
| + String key = _getKey();
|
| + return (name === null) ? "Expando:${key}" : "Expando:${name}@${key}";
|
| + }
|
| +
|
| + String _getKey() {
|
| + String key = Primitives.getProperty(this, KEY_PROPERTY_NAME);
|
| + if (key === null) {
|
| + key = "expando\$key\$${keyCount++}";
|
| + Primitives.setProperty(this, KEY_PROPERTY_NAME, key);
|
| + }
|
| + return key;
|
| + }
|
| +
|
| + static final String KEY_PROPERTY_NAME = 'expando\$key';
|
| + static final String EXPANDO_PROPERTY_NAME = 'expando\$values';
|
| + static int keyCount = 0;
|
| +
|
| +}
|
|
|