[JS IR] Fix native invoke checker
This commit is contained in:
+3
-4
@@ -62,12 +62,11 @@ fun translateFunction(declaration: IrFunction, name: JsName?, context: JsGenerat
|
|||||||
return function
|
return function
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun isNativeInvoke(call: IrCall): Boolean {
|
private fun isNativeInvoke(receiver: JsExpression?, call: IrCall): Boolean {
|
||||||
|
if (receiver == null || receiver is JsThisRef) return false
|
||||||
val simpleFunction = call.symbol.owner as? IrSimpleFunction ?: return false
|
val simpleFunction = call.symbol.owner as? IrSimpleFunction ?: return false
|
||||||
val receiverType = simpleFunction.dispatchReceiverParameter?.type ?: return false
|
val receiverType = simpleFunction.dispatchReceiverParameter?.type ?: return false
|
||||||
|
|
||||||
if (simpleFunction.isSuspend) return false
|
|
||||||
|
|
||||||
if (call.origin === InteropCallableReferenceLowering.Companion.EXPLICIT_INVOKE) return false
|
if (call.origin === InteropCallableReferenceLowering.Companion.EXPLICIT_INVOKE) return false
|
||||||
|
|
||||||
return simpleFunction.name == OperatorNameConventions.INVOKE && receiverType.isFunctionTypeOrSubtype()
|
return simpleFunction.name == OperatorNameConventions.INVOKE && receiverType.isFunctionTypeOrSubtype()
|
||||||
@@ -105,7 +104,7 @@ fun translateCall(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isNativeInvoke(expression)) {
|
if (isNativeInvoke(jsDispatchReceiver, expression)) {
|
||||||
return JsInvocation(jsDispatchReceiver!!, arguments)
|
return JsInvocation(jsDispatchReceiver!!, arguments)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user