JS backend: fix runtime type checking for interfaces

This commit is contained in:
Zalim Bashorov
2016-08-09 20:47:16 +03:00
parent 060255e8f7
commit 9ece62fa0f
+7 -1
View File
@@ -366,12 +366,18 @@
return false;
}
/**
*
* @param {*} object
* @param {Function|Object} klass
* @returns {Boolean}
*/
Kotlin.isType = function (object, klass) {
if (object == null || klass == null || (typeof object !== 'object' && typeof object !== 'function')) {
return false;
}
else {
if (object instanceof klass) {
if (typeof klass === "function" && object instanceof klass) {
return true;
}
else if (isNativeClass(klass) || klass.$metadata$.type == Kotlin.TYPE.CLASS) {