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; return false;
} }
/**
*
* @param {*} object
* @param {Function|Object} klass
* @returns {Boolean}
*/
Kotlin.isType = function (object, klass) { Kotlin.isType = function (object, klass) {
if (object == null || klass == null || (typeof object !== 'object' && typeof object !== 'function')) { if (object == null || klass == null || (typeof object !== 'object' && typeof object !== 'function')) {
return false; return false;
} }
else { else {
if (object instanceof klass) { if (typeof klass === "function" && object instanceof klass) {
return true; return true;
} }
else if (isNativeClass(klass) || klass.$metadata$.type == Kotlin.TYPE.CLASS) { else if (isNativeClass(klass) || klass.$metadata$.type == Kotlin.TYPE.CLASS) {