implement comparator more correct, so, we can get rid of skipSeal flag for std classes

This commit is contained in:
develar
2012-06-28 10:30:16 +04:00
parent 4ce4cdfbd5
commit 1041837122
2 changed files with 10 additions and 10 deletions
+8 -3
View File
@@ -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);
};