implement comparator more correct, so, we can get rid of skipSeal flag for std classes
This commit is contained in:
@@ -306,10 +306,15 @@ var kotlin = {set:function (receiver, key, value) {
|
||||
}
|
||||
);
|
||||
|
||||
var ComparatorImpl = Kotlin.$createClass(Kotlin.Comparator, {
|
||||
initialize: function (comparator) {
|
||||
this.compare = comparator;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
Kotlin.comparator = function (f) {
|
||||
var result = Kotlin.$new(Kotlin.Comparator)();
|
||||
result.compare = f;
|
||||
return result;
|
||||
return Kotlin.$new(ComparatorImpl)(f);
|
||||
};
|
||||
|
||||
Kotlin.collectionsMax = function (col, comp) {
|
||||
|
||||
@@ -66,9 +66,8 @@ var Kotlin = {};
|
||||
if (initializer != null) {
|
||||
initializer.apply(o, arguments);
|
||||
}
|
||||
if (initializer == null || !initializer.hasOwnProperty("skipSeal")) {
|
||||
Object.seal(o);
|
||||
}
|
||||
|
||||
Object.seal(o);
|
||||
return o;
|
||||
};
|
||||
}
|
||||
@@ -164,10 +163,6 @@ var Kotlin = {};
|
||||
}
|
||||
}
|
||||
|
||||
if (initializer) {
|
||||
Object.defineProperty(initializer, "skipSeal", {value: true});
|
||||
}
|
||||
|
||||
return Kotlin.createClass(parent || null, initializer, descriptors);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user