JS backend: fix runtime type checking for interfaces
This commit is contained in:
+7
-1
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user