JS backend: implemented PrimitiveHashMap#putAll.

This commit is contained in:
Zalim Bashorov
2013-06-21 16:21:28 +04:00
parent fa10a3289d
commit 9d1e319f0f
2 changed files with 8 additions and 1 deletions
+7 -1
View File
@@ -472,7 +472,13 @@ Kotlin.ComplexHashMap = Kotlin.HashMap;
this.map = {};
},
putAll: function (fromMap) {
throw Kotlin.$new(Kotlin.UnsupportedOperationException)();
var map = fromMap.map;
for (var key in map) {
if (map.hasOwnProperty(key)) {
this.map[key] = map[key];
this.$size++;
}
}
},
keySet: function () {
var result = Kotlin.$new(Kotlin.PrimitiveHashSet)();
+1
View File
@@ -5,6 +5,7 @@ import kotlin.test.*
import java.util.*
import org.junit.Test as test
// TODO: Write test generator for testing `Map` implementations.
class MapJsTest {
//TODO: replace `array(...).toList()` to `listOf(...)`
val KEYS = array("zero", "one", "two", "three").toList()