JS/RTTI. Fix run-time type checking against Comparable

This commit is contained in:
Alexey Tsvetkov
2015-06-25 00:11:17 +03:00
committed by Alexey Andreev
parent 390d71ac8d
commit 9bb60b48b2
6 changed files with 118 additions and 6 deletions
+9
View File
@@ -126,6 +126,15 @@
return (typeof value) == "string" && value.length == 1;
};
Kotlin.isComparable = function (value) {
var type = typeof value;
return type === "string" ||
type === "boolean" ||
Kotlin.isNumber(value) ||
Kotlin.isType(value, Kotlin.Comparable);
};
Kotlin.charInc = function (value) {
return String.fromCharCode(value.charCodeAt(0)+1);
};