diff --git a/modules/facade/src/collection.dart b/modules/facade/src/collection.dart index f0e6d1af0a..0f9b824bde 100644 --- a/modules/facade/src/collection.dart +++ b/modules/facade/src/collection.dart @@ -14,6 +14,17 @@ class MapWrapper { static int size(m) {return m.length;} } +// TODO: how to export StringMap=Map as a type? +class StringMapWrapper { + static HashMap create() => new HashMap(); + static get(map, key) { + return map[key]; + } + static set(map, key, value) { + map[key] = value; + } +} + class ListWrapper { static List clone(List l) => new List.from(l); static List create() => new List(); diff --git a/modules/facade/src/collection.es6 b/modules/facade/src/collection.es6 index a3e00df39a..00b1964552 100644 --- a/modules/facade/src/collection.es6 +++ b/modules/facade/src/collection.es6 @@ -13,6 +13,19 @@ export class MapWrapper { static size(m) {return m.size;} } +// TODO: cannot export StringMap as a type as Dart does not support +// renaming types... +export class StringMapWrapper { + // Note: We are not using Object.create(null) here due to + // performance! + static create():Object { return { }; } + static get(map, key) { + return map.hasOwnProperty(key) ? map[key] : undefined; + } + static set(map, key, value) { + map[key] = value; + } +} export class ListWrapper { static create():List { return new List(); }