JS backend: correct hierarchy for collections in kotlin_lib.js, maps.js
This commit is contained in:
@@ -224,14 +224,7 @@
|
|||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
var lazyInitClasses = {};
|
||||||
* @interface
|
|
||||||
* @template T
|
|
||||||
*/
|
|
||||||
Kotlin.Iterator = Kotlin.createClassNow(null, null, {
|
|
||||||
next: throwAbstractFunctionInvocationError("Iterator#next"),
|
|
||||||
hasNext: throwAbstractFunctionInvocationError("Iterator#hasNext")
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
@@ -241,7 +234,10 @@
|
|||||||
* @param {Array.<T>} array
|
* @param {Array.<T>} array
|
||||||
* @template T
|
* @template T
|
||||||
*/
|
*/
|
||||||
var ArrayIterator = Kotlin.createClassNow(Kotlin.Iterator,
|
lazyInitClasses.ArrayIterator = Kotlin.createClass(
|
||||||
|
function () {
|
||||||
|
return [Kotlin.modules['stdlib'].kotlin.MutableIterator];
|
||||||
|
},
|
||||||
/** @constructs */
|
/** @constructs */
|
||||||
function (array) {
|
function (array) {
|
||||||
this.array = array;
|
this.array = array;
|
||||||
@@ -270,7 +266,10 @@
|
|||||||
* @param {Kotlin.AbstractList.<T>} list
|
* @param {Kotlin.AbstractList.<T>} list
|
||||||
* @template T
|
* @template T
|
||||||
*/
|
*/
|
||||||
var ListIterator = Kotlin.createClassNow(ArrayIterator,
|
lazyInitClasses.ListIterator = Kotlin.createClass(
|
||||||
|
function () {
|
||||||
|
return [Kotlin.modules['stdlib'].kotlin.Iterator];
|
||||||
|
},
|
||||||
/** @constructs */
|
/** @constructs */
|
||||||
function (list) {
|
function (list) {
|
||||||
this.list = list;
|
this.list = list;
|
||||||
@@ -282,12 +281,6 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
|
||||||
* @interface
|
|
||||||
* @template T
|
|
||||||
*/
|
|
||||||
Kotlin.Collection = Kotlin.createClassNow();
|
|
||||||
|
|
||||||
Kotlin.Enum = Kotlin.createClassNow(null,
|
Kotlin.Enum = Kotlin.createClassNow(null,
|
||||||
function () {
|
function () {
|
||||||
this.name$ = undefined;
|
this.name$ = undefined;
|
||||||
@@ -311,7 +304,10 @@
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
Kotlin.AbstractCollection = Kotlin.createClassNow(Kotlin.Collection, null, {
|
lazyInitClasses.AbstractCollection = Kotlin.createClass(
|
||||||
|
function () {
|
||||||
|
return [Kotlin.modules['stdlib'].kotlin.MutableCollection];
|
||||||
|
}, null, {
|
||||||
addAll_4fm7v2$: function (collection) {
|
addAll_4fm7v2$: function (collection) {
|
||||||
var modified = false;
|
var modified = false;
|
||||||
var it = collection.iterator();
|
var it = collection.iterator();
|
||||||
@@ -355,7 +351,7 @@
|
|||||||
return this.size() === 0;
|
return this.size() === 0;
|
||||||
},
|
},
|
||||||
iterator: function () {
|
iterator: function () {
|
||||||
return new ArrayIterator(this.toArray());
|
return new Kotlin.ArrayIterator(this.toArray());
|
||||||
},
|
},
|
||||||
equals_za3rmp$: function (o) {
|
equals_za3rmp$: function (o) {
|
||||||
if (this.size() !== o.size()) return false;
|
if (this.size() !== o.size()) return false;
|
||||||
@@ -397,9 +393,12 @@
|
|||||||
* @interface // actually it's abstract class
|
* @interface // actually it's abstract class
|
||||||
* @template T
|
* @template T
|
||||||
*/
|
*/
|
||||||
Kotlin.AbstractList = Kotlin.createClassNow(Kotlin.AbstractCollection, null, {
|
lazyInitClasses.AbstractList = Kotlin.createClass(
|
||||||
|
function () {
|
||||||
|
return [Kotlin.modules['stdlib'].kotlin.MutableList, Kotlin.AbstractCollection];
|
||||||
|
}, null, {
|
||||||
iterator: function () {
|
iterator: function () {
|
||||||
return new ListIterator(this);
|
return new Kotlin.ListIterator(this);
|
||||||
},
|
},
|
||||||
remove_za3rmp$: function (o) {
|
remove_za3rmp$: function (o) {
|
||||||
var index = this.indexOf_za3rmp$(o);
|
var index = this.indexOf_za3rmp$(o);
|
||||||
@@ -415,7 +414,10 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
//TODO: should be JS Array-like (https://developer.mozilla.org/en-US/docs/JavaScript/Guide/Predefined_Core_Objects#Working_with_Array-like_objects)
|
//TODO: should be JS Array-like (https://developer.mozilla.org/en-US/docs/JavaScript/Guide/Predefined_Core_Objects#Working_with_Array-like_objects)
|
||||||
Kotlin.ArrayList = Kotlin.createClassNow(Kotlin.AbstractList,
|
lazyInitClasses.ArrayList = Kotlin.createClass(
|
||||||
|
function () {
|
||||||
|
return [Kotlin.AbstractList];
|
||||||
|
},
|
||||||
function () {
|
function () {
|
||||||
this.array = [];
|
this.array = [];
|
||||||
}, {
|
}, {
|
||||||
@@ -569,7 +571,10 @@
|
|||||||
Kotlin.System.out().print(s);
|
Kotlin.System.out().print(s);
|
||||||
};
|
};
|
||||||
|
|
||||||
Kotlin.RangeIterator = Kotlin.createClassNow(Kotlin.Iterator,
|
lazyInitClasses.RangeIterator = Kotlin.createClass(
|
||||||
|
function () {
|
||||||
|
return [Kotlin.modules['stdlib'].kotlin.Iterator];
|
||||||
|
},
|
||||||
function (start, end, increment) {
|
function (start, end, increment) {
|
||||||
this.start = start;
|
this.start = start;
|
||||||
this.end = end;
|
this.end = end;
|
||||||
@@ -641,7 +646,10 @@
|
|||||||
equals_za3rmp$: isSameNotNullRanges
|
equals_za3rmp$: isSameNotNullRanges
|
||||||
});
|
});
|
||||||
|
|
||||||
Kotlin.LongRangeIterator = Kotlin.createClassNow(Kotlin.Iterator,
|
lazyInitClasses.LongRangeIterator = Kotlin.createClass(
|
||||||
|
function () {
|
||||||
|
return [Kotlin.modules['stdlib'].kotlin.Iterator];
|
||||||
|
},
|
||||||
function (start, end, increment) {
|
function (start, end, increment) {
|
||||||
this.start = start;
|
this.start = start;
|
||||||
this.end = end;
|
this.end = end;
|
||||||
@@ -704,7 +712,10 @@
|
|||||||
equals_za3rmp$: isSameNotNullRanges
|
equals_za3rmp$: isSameNotNullRanges
|
||||||
});
|
});
|
||||||
|
|
||||||
Kotlin.CharRangeIterator = Kotlin.createClassNow(Kotlin.RangeIterator,
|
lazyInitClasses.CharRangeIterator = Kotlin.createClass(
|
||||||
|
function () {
|
||||||
|
return [Kotlin.RangeIterator];
|
||||||
|
},
|
||||||
function (start, end, increment) {
|
function (start, end, increment) {
|
||||||
Kotlin.RangeIterator.call(this, start, end, increment);
|
Kotlin.RangeIterator.call(this, start, end, increment);
|
||||||
}, {
|
}, {
|
||||||
@@ -918,7 +929,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
Kotlin.arrayIterator = function (array) {
|
Kotlin.arrayIterator = function (array) {
|
||||||
return new ArrayIterator(array);
|
return new Kotlin.ArrayIterator(array);
|
||||||
};
|
};
|
||||||
|
|
||||||
Kotlin.jsonFromTuples = function (pairArr) {
|
Kotlin.jsonFromTuples = function (pairArr) {
|
||||||
@@ -939,4 +950,6 @@
|
|||||||
}
|
}
|
||||||
return obj1;
|
return obj1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Kotlin.createDefinition(lazyInitClasses, Kotlin);
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -404,8 +404,10 @@ var Kotlin = {};
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function createDefinition(members) {
|
function createDefinition(members, definition) {
|
||||||
var definition = {};
|
if (typeof definition === "undefined") {
|
||||||
|
definition = {}
|
||||||
|
}
|
||||||
if (members == null) {
|
if (members == null) {
|
||||||
return definition;
|
return definition;
|
||||||
}
|
}
|
||||||
@@ -431,6 +433,8 @@ var Kotlin = {};
|
|||||||
return definition;
|
return definition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Kotlin.createDefinition = createDefinition;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {function()|null=} initializer
|
* @param {function()|null=} initializer
|
||||||
* @param {Object=} members
|
* @param {Object=} members
|
||||||
|
|||||||
+223
-187
@@ -413,19 +413,18 @@
|
|||||||
|
|
||||||
Kotlin.HashTable = Hashtable;
|
Kotlin.HashTable = Hashtable;
|
||||||
|
|
||||||
/**
|
var lazyInitClasses = {};
|
||||||
* @interface
|
|
||||||
* @template Key, Value
|
|
||||||
*/
|
|
||||||
Kotlin.Map = Kotlin.createClassNow();
|
|
||||||
|
|
||||||
Kotlin.HashMap = Kotlin.createClassNow(Kotlin.Map,
|
lazyInitClasses.HashMap = Kotlin.createClass(
|
||||||
|
function () {
|
||||||
|
return [Kotlin.modules['stdlib'].kotlin.MutableMap];
|
||||||
|
},
|
||||||
function () {
|
function () {
|
||||||
Kotlin.HashTable.call(this);
|
Kotlin.HashTable.call(this);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
Kotlin.ComplexHashMap = Kotlin.HashMap;
|
Object.defineProperty(Kotlin, "ComplexHashMap", { get : function () { return Kotlin.HashMap; }});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
@@ -436,7 +435,10 @@
|
|||||||
* @param {Array.<Value>} keys
|
* @param {Array.<Value>} keys
|
||||||
* @template Key, Value
|
* @template Key, Value
|
||||||
*/
|
*/
|
||||||
var PrimitiveHashMapValuesIterator = Kotlin.createClassNow(Kotlin.Iterator,
|
lazyInitClasses.PrimitiveHashMapValuesIterator = Kotlin.createClass(
|
||||||
|
function () {
|
||||||
|
return [Kotlin.modules['stdlib'].kotlin.Iterator];
|
||||||
|
},
|
||||||
function (map, keys) {
|
function (map, keys) {
|
||||||
this.map = map;
|
this.map = map;
|
||||||
this.keys = keys;
|
this.keys = keys;
|
||||||
@@ -459,12 +461,15 @@
|
|||||||
* @param {Kotlin.PrimitiveHashMap.<Key, Value>} map
|
* @param {Kotlin.PrimitiveHashMap.<Key, Value>} map
|
||||||
* @template Key, Value
|
* @template Key, Value
|
||||||
*/
|
*/
|
||||||
var PrimitiveHashMapValues = Kotlin.createClassNow(Kotlin.Collection,
|
lazyInitClasses.PrimitiveHashMapValues = Kotlin.createClass(
|
||||||
|
function () {
|
||||||
|
return [Kotlin.modules['stdlib'].kotlin.Collection];
|
||||||
|
},
|
||||||
function (map) {
|
function (map) {
|
||||||
this.map = map;
|
this.map = map;
|
||||||
}, {
|
}, {
|
||||||
iterator: function () {
|
iterator: function () {
|
||||||
return new PrimitiveHashMapValuesIterator(this.map.map, Object.keys(this.map.map));
|
return new Kotlin.PrimitiveHashMapValuesIterator(this.map.map, Object.keys(this.map.map));
|
||||||
},
|
},
|
||||||
isEmpty: function () {
|
isEmpty: function () {
|
||||||
return this.map.$size === 0;
|
return this.map.$size === 0;
|
||||||
@@ -481,7 +486,10 @@
|
|||||||
* @constructor
|
* @constructor
|
||||||
* @template Key, Value
|
* @template Key, Value
|
||||||
*/
|
*/
|
||||||
Kotlin.AbstractPrimitiveHashMap = Kotlin.createClassNow(Kotlin.Map,
|
lazyInitClasses.AbstractPrimitiveHashMap = Kotlin.createClass(
|
||||||
|
function () {
|
||||||
|
return [Kotlin.HashMap];
|
||||||
|
},
|
||||||
function () {
|
function () {
|
||||||
this.$size = 0;
|
this.$size = 0;
|
||||||
this.map = Object.create(null);
|
this.map = Object.create(null);
|
||||||
@@ -555,14 +563,17 @@
|
|||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
values: function () {
|
values: function () {
|
||||||
return new PrimitiveHashMapValues(this);
|
return new Kotlin.PrimitiveHashMapValues(this);
|
||||||
},
|
},
|
||||||
toJSON: function () {
|
toJSON: function () {
|
||||||
return this.map;
|
return this.map;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Kotlin.DefaultPrimitiveHashMap = Kotlin.createClassNow(Kotlin.AbstractPrimitiveHashMap,
|
lazyInitClasses.DefaultPrimitiveHashMap = Kotlin.createClass(
|
||||||
|
function () {
|
||||||
|
return [Kotlin.AbstractPrimitiveHashMap];
|
||||||
|
},
|
||||||
function () {
|
function () {
|
||||||
Kotlin.AbstractPrimitiveHashMap.call(this);
|
Kotlin.AbstractPrimitiveHashMap.call(this);
|
||||||
}, {
|
}, {
|
||||||
@@ -571,7 +582,10 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Kotlin.PrimitiveNumberHashMap = Kotlin.createClassNow(Kotlin.AbstractPrimitiveHashMap,
|
lazyInitClasses.PrimitiveNumberHashMap = Kotlin.createClass(
|
||||||
|
function () {
|
||||||
|
return [Kotlin.AbstractPrimitiveHashMap];
|
||||||
|
},
|
||||||
function () {
|
function () {
|
||||||
Kotlin.AbstractPrimitiveHashMap.call(this);
|
Kotlin.AbstractPrimitiveHashMap.call(this);
|
||||||
this.$keySetClass$ = Kotlin.PrimitiveNumberHashSet;
|
this.$keySetClass$ = Kotlin.PrimitiveNumberHashSet;
|
||||||
@@ -581,7 +595,10 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Kotlin.PrimitiveBooleanHashMap = Kotlin.createClassNow(Kotlin.AbstractPrimitiveHashMap,
|
lazyInitClasses.PrimitiveBooleanHashMap = Kotlin.createClass(
|
||||||
|
function () {
|
||||||
|
return [Kotlin.AbstractPrimitiveHashMap];
|
||||||
|
},
|
||||||
function () {
|
function () {
|
||||||
Kotlin.AbstractPrimitiveHashMap.call(this);
|
Kotlin.AbstractPrimitiveHashMap.call(this);
|
||||||
}, {
|
}, {
|
||||||
@@ -647,12 +664,19 @@
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
LinkedHashMap.prototype = Object.create(Kotlin.ComplexHashMap);
|
lazyInitClasses.LinkedHashMap = Kotlin.createClass(
|
||||||
|
function () {
|
||||||
|
return [Kotlin.ComplexHashMap];
|
||||||
|
},
|
||||||
|
function () {
|
||||||
|
LinkedHashMap.call(this);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
Kotlin.LinkedHashMap = LinkedHashMap;
|
lazyInitClasses.LinkedHashSet = Kotlin.createClass(
|
||||||
|
function () {
|
||||||
|
return [Kotlin.modules['stdlib'].kotlin.MutableSet, Kotlin.HashSet];
|
||||||
Kotlin.LinkedHashSet = Kotlin.createClassNow(Kotlin.AbstractCollection,
|
},
|
||||||
/** @constructs */
|
/** @constructs */
|
||||||
function () {
|
function () {
|
||||||
this.map = new Kotlin.LinkedHashMap();
|
this.map = new Kotlin.LinkedHashMap();
|
||||||
@@ -666,7 +690,7 @@
|
|||||||
return this.map.containsKey_za3rmp$(element);
|
return this.map.containsKey_za3rmp$(element);
|
||||||
},
|
},
|
||||||
iterator: function () {
|
iterator: function () {
|
||||||
return new SetIterator(this);
|
return new Kotlin.SetIterator(this);
|
||||||
},
|
},
|
||||||
add_za3rmp$: function (element) {
|
add_za3rmp$: function (element) {
|
||||||
return this.map.put_wn2jw4$(element, true) == null;
|
return this.map.put_wn2jw4$(element, true) == null;
|
||||||
@@ -682,185 +706,192 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}());
|
/**
|
||||||
|
* @class
|
||||||
|
* @constructor
|
||||||
|
* @param {Kotlin.Set} set
|
||||||
|
*/
|
||||||
|
lazyInitClasses.SetIterator = Kotlin.createClass(
|
||||||
|
function () {
|
||||||
|
return [Kotlin.modules['stdlib'].kotlin.MutableIterator];
|
||||||
|
},
|
||||||
|
function (set) {
|
||||||
|
this.set = set;
|
||||||
|
this.keys = set.toArray();
|
||||||
|
this.index = 0;
|
||||||
|
},
|
||||||
|
/** @lends SetIterator.prototype */
|
||||||
|
{
|
||||||
|
next: function () {
|
||||||
|
return this.keys[this.index++];
|
||||||
|
},
|
||||||
|
hasNext: function () {
|
||||||
|
return this.index < this.keys.length;
|
||||||
|
},
|
||||||
|
remove: function () {
|
||||||
|
this.set.remove_za3rmp$(this.keys[this.index - 1]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @interface
|
* @class
|
||||||
*/
|
* @constructor
|
||||||
Kotlin.Set = Kotlin.createClassNow(Kotlin.Collection);
|
* @extends {Kotlin.Collection.<T>}
|
||||||
|
* @template T
|
||||||
/**
|
*/
|
||||||
* @class
|
lazyInitClasses.AbstractPrimitiveHashSet = Kotlin.createClass(
|
||||||
* @constructor
|
function () {
|
||||||
* @param {Kotlin.Set} set
|
return [Kotlin.HashSet];
|
||||||
*/
|
|
||||||
var SetIterator = Kotlin.createClassNow(Kotlin.Iterator,
|
|
||||||
function (set) {
|
|
||||||
this.set = set;
|
|
||||||
this.keys = set.toArray();
|
|
||||||
this.index = 0;
|
|
||||||
},
|
|
||||||
/** @lends SetIterator.prototype */
|
|
||||||
{
|
|
||||||
next: function () {
|
|
||||||
return this.keys[this.index++];
|
|
||||||
},
|
},
|
||||||
hasNext: function () {
|
/** @constructs */
|
||||||
return this.index < this.keys.length;
|
function () {
|
||||||
},
|
|
||||||
remove: function () {
|
|
||||||
this.set.remove_za3rmp$(this.keys[this.index - 1]);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @class
|
|
||||||
* @constructor
|
|
||||||
* @extends {Kotlin.Collection.<T>}
|
|
||||||
* @template T
|
|
||||||
*/
|
|
||||||
Kotlin.AbstractPrimitiveHashSet = Kotlin.createClassNow(Kotlin.AbstractCollection,
|
|
||||||
/** @constructs */
|
|
||||||
function () {
|
|
||||||
this.$size = 0;
|
|
||||||
this.map = {};
|
|
||||||
},
|
|
||||||
/** @lends {Kotlin.AbstractPrimitiveHashSet.prototype} */
|
|
||||||
{
|
|
||||||
size: function () {
|
|
||||||
return this.$size;
|
|
||||||
},
|
|
||||||
contains_za3rmp$: function (key) {
|
|
||||||
return this.map[key] === true;
|
|
||||||
},
|
|
||||||
iterator: function () {
|
|
||||||
return new SetIterator(this);
|
|
||||||
},
|
|
||||||
add_za3rmp$: function (element) {
|
|
||||||
var prevElement = this.map[element];
|
|
||||||
this.map[element] = true;
|
|
||||||
if (prevElement === true) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.$size++;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
remove_za3rmp$: function (element) {
|
|
||||||
if (this.map[element] === true) {
|
|
||||||
delete this.map[element];
|
|
||||||
this.$size--;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
clear: function () {
|
|
||||||
this.$size = 0;
|
this.$size = 0;
|
||||||
this.map = {};
|
this.map = {};
|
||||||
},
|
},
|
||||||
convertKeyToKeyType: function (key) {
|
/** @lends {Kotlin.AbstractPrimitiveHashSet.prototype} */
|
||||||
throw new Error("Kotlin.AbstractPrimitiveHashSet.convertKeyToKeyType is abstract");
|
{
|
||||||
},
|
size: function () {
|
||||||
toArray: function () {
|
return this.$size;
|
||||||
var result = Object.keys(this.map);
|
},
|
||||||
for(var i=0; i<result.length; i++) {
|
contains_za3rmp$: function (key) {
|
||||||
result[i] = this.convertKeyToKeyType(result[i]);
|
return this.map[key] === true;
|
||||||
}
|
},
|
||||||
return result;
|
iterator: function () {
|
||||||
}
|
return new Kotlin.SetIterator(this);
|
||||||
});
|
},
|
||||||
|
add_za3rmp$: function (element) {
|
||||||
var PROTO_NAME = "__proto__";
|
var prevElement = this.map[element];
|
||||||
|
this.map[element] = true;
|
||||||
Kotlin.DefaultPrimitiveHashSet = Kotlin.createClassNow(Kotlin.AbstractPrimitiveHashSet,
|
if (prevElement === true) {
|
||||||
/** @constructs */
|
return false;
|
||||||
function () {
|
|
||||||
var superClass = Kotlin.AbstractPrimitiveHashSet;
|
|
||||||
|
|
||||||
superClass.call(this);
|
|
||||||
this.super = superClass.prototype;
|
|
||||||
|
|
||||||
this.containsProto = false;
|
|
||||||
},
|
|
||||||
/** @lends {Kotlin.DefaultPrimitiveHashSet.prototype} */
|
|
||||||
{
|
|
||||||
contains_za3rmp$: function (key) {
|
|
||||||
var skey = String(key);
|
|
||||||
if (skey === PROTO_NAME) {
|
|
||||||
return this.containsProto;
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.super.contains_za3rmp$.call(this, key);
|
|
||||||
},
|
|
||||||
add_za3rmp$: function (element) {
|
|
||||||
var skey = String(element);
|
|
||||||
if (skey === PROTO_NAME) {
|
|
||||||
var isNewElement = !this.containsProto;
|
|
||||||
|
|
||||||
if (isNewElement) {
|
|
||||||
this.containsProto = true;
|
|
||||||
this.$size++;
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
return isNewElement;
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.super.add_za3rmp$.call(this, element);
|
|
||||||
},
|
|
||||||
remove_za3rmp$: function (element) {
|
|
||||||
var skey = String(element);
|
|
||||||
if (skey === PROTO_NAME) {
|
|
||||||
var contains = this.containsProto;
|
|
||||||
|
|
||||||
if (contains) {
|
|
||||||
this.containsProto = false;
|
|
||||||
this.$size++;
|
this.$size++;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
},
|
||||||
return contains;
|
remove_za3rmp$: function (element) {
|
||||||
|
if (this.map[element] === true) {
|
||||||
|
delete this.map[element];
|
||||||
|
this.$size--;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
clear: function () {
|
||||||
|
this.$size = 0;
|
||||||
|
this.map = {};
|
||||||
|
},
|
||||||
|
convertKeyToKeyType: function (key) {
|
||||||
|
throw new Error("Kotlin.AbstractPrimitiveHashSet.convertKeyToKeyType is abstract");
|
||||||
|
},
|
||||||
|
toArray: function () {
|
||||||
|
var result = Object.keys(this.map);
|
||||||
|
for(var i=0; i<result.length; i++) {
|
||||||
|
result[i] = this.convertKeyToKeyType(result[i]);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return this.super.remove_za3rmp$.call(this, element);
|
var PROTO_NAME = "__proto__";
|
||||||
|
|
||||||
|
lazyInitClasses.DefaultPrimitiveHashSet = Kotlin.createClass(
|
||||||
|
function () {
|
||||||
|
return [Kotlin.AbstractPrimitiveHashSet];
|
||||||
},
|
},
|
||||||
clear: function () {
|
/** @constructs */
|
||||||
this.$size = 0;
|
function () {
|
||||||
|
var superClass = Kotlin.AbstractPrimitiveHashSet;
|
||||||
|
|
||||||
|
superClass.call(this);
|
||||||
|
this.super = superClass.prototype;
|
||||||
|
|
||||||
this.containsProto = false;
|
this.containsProto = false;
|
||||||
this.map = {};
|
|
||||||
},
|
},
|
||||||
toArray: function () {
|
/** @lends {Kotlin.DefaultPrimitiveHashSet.prototype} */
|
||||||
var elements = Object.keys(this.map);
|
{
|
||||||
return !this.containsProto ? elements : elements.concat(PROTO_NAME);
|
contains_za3rmp$: function (key) {
|
||||||
}
|
var skey = String(key);
|
||||||
});
|
if (skey === PROTO_NAME) {
|
||||||
|
return this.containsProto;
|
||||||
|
}
|
||||||
|
|
||||||
Kotlin.PrimitiveNumberHashSet = Kotlin.createClassNow(Kotlin.AbstractPrimitiveHashSet,
|
return this.super.contains_za3rmp$.call(this, key);
|
||||||
/** @constructs */
|
},
|
||||||
function () {
|
add_za3rmp$: function (element) {
|
||||||
Kotlin.AbstractPrimitiveHashSet.call(this);
|
var skey = String(element);
|
||||||
},
|
if (skey === PROTO_NAME) {
|
||||||
/** @lends {Kotlin.PrimitiveNumberHashSet.prototype} */
|
var isNewElement = !this.containsProto;
|
||||||
{
|
|
||||||
convertKeyToKeyType: function (key) {
|
|
||||||
return +key;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Kotlin.PrimitiveBooleanHashSet = Kotlin.createClassNow(Kotlin.AbstractPrimitiveHashSet,
|
if (isNewElement) {
|
||||||
/** @constructs */
|
this.containsProto = true;
|
||||||
function () {
|
this.$size++;
|
||||||
Kotlin.AbstractPrimitiveHashSet.call(this);
|
}
|
||||||
},
|
|
||||||
/** @lends {Kotlin.PrimitiveBooleanHashSet.prototype} */
|
return isNewElement;
|
||||||
{
|
}
|
||||||
convertKeyToKeyType: function (key) {
|
|
||||||
return key == "true";
|
return this.super.add_za3rmp$.call(this, element);
|
||||||
}
|
},
|
||||||
});
|
remove_za3rmp$: function (element) {
|
||||||
|
var skey = String(element);
|
||||||
|
if (skey === PROTO_NAME) {
|
||||||
|
var contains = this.containsProto;
|
||||||
|
|
||||||
|
if (contains) {
|
||||||
|
this.containsProto = false;
|
||||||
|
this.$size++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return contains;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.super.remove_za3rmp$.call(this, element);
|
||||||
|
},
|
||||||
|
clear: function () {
|
||||||
|
this.$size = 0;
|
||||||
|
this.containsProto = false;
|
||||||
|
this.map = {};
|
||||||
|
},
|
||||||
|
toArray: function () {
|
||||||
|
var elements = Object.keys(this.map);
|
||||||
|
return !this.containsProto ? elements : elements.concat(PROTO_NAME);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
lazyInitClasses.PrimitiveNumberHashSet = Kotlin.createClass(
|
||||||
|
function () {
|
||||||
|
return [Kotlin.AbstractPrimitiveHashSet];
|
||||||
|
},
|
||||||
|
/** @constructs */
|
||||||
|
function () {
|
||||||
|
Kotlin.AbstractPrimitiveHashSet.call(this);
|
||||||
|
},
|
||||||
|
/** @lends {Kotlin.PrimitiveNumberHashSet.prototype} */
|
||||||
|
{
|
||||||
|
convertKeyToKeyType: function (key) {
|
||||||
|
return +key;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
lazyInitClasses.PrimitiveBooleanHashSet = Kotlin.createClass(
|
||||||
|
function () {
|
||||||
|
return [Kotlin.AbstractPrimitiveHashSet];
|
||||||
|
},
|
||||||
|
/** @constructs */
|
||||||
|
function () {
|
||||||
|
Kotlin.AbstractPrimitiveHashSet.call(this);
|
||||||
|
},
|
||||||
|
/** @lends {Kotlin.PrimitiveBooleanHashSet.prototype} */
|
||||||
|
{
|
||||||
|
convertKeyToKeyType: function (key) {
|
||||||
|
return key == "true";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
(function () {
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
* @constructor
|
* @constructor
|
||||||
@@ -886,7 +917,7 @@ Kotlin.PrimitiveBooleanHashSet = Kotlin.createClassNow(Kotlin.AbstractPrimitiveH
|
|||||||
|
|
||||||
/** @suppress {checkTypes} */
|
/** @suppress {checkTypes} */
|
||||||
this.iterator = function () {
|
this.iterator = function () {
|
||||||
return new SetIterator(this);
|
return new Kotlin.SetIterator(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.remove_za3rmp$ = function (o) {
|
this.remove_za3rmp$ = function (o) {
|
||||||
@@ -989,11 +1020,16 @@ Kotlin.PrimitiveBooleanHashSet = Kotlin.createClassNow(Kotlin.AbstractPrimitiveH
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
Kotlin.HashSet = Kotlin.createClassNow(Kotlin.Set,
|
lazyInitClasses.HashSet = Kotlin.createClass(
|
||||||
|
function () {
|
||||||
|
return [Kotlin.modules['stdlib'].kotlin.MutableSet, Kotlin.AbstractCollection];
|
||||||
|
},
|
||||||
function () {
|
function () {
|
||||||
HashSet.call(this);
|
HashSet.call(this);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
Kotlin.ComplexHashSet = Kotlin.HashSet;
|
Object.defineProperty(Kotlin, "ComplexHashSet", { get : function () { return Kotlin.HashSet; }});
|
||||||
|
|
||||||
|
Kotlin.createDefinition(lazyInitClasses, Kotlin);
|
||||||
}());
|
}());
|
||||||
|
|||||||
Reference in New Issue
Block a user