[Wasm] Support callable references to external functions

1. Move jsInteropFunctionsLowering after callable reference lowering,
  so it can continue to deal with just functions and function calls.
2. Generate lowered closure class in JsInteropFunctionsLowering because
This commit is contained in:
Svyatoslav Kuzmich
2021-11-10 13:41:20 +03:00
parent 916379c0e7
commit c0761bf34a
3 changed files with 90 additions and 49 deletions
+34 -17
View File
@@ -199,25 +199,42 @@ fun box(): String {
)
if (externalWithLambdas2Count != 11) return "Fail externalWithLambdas2"
val jsLambda = createJsLambda()
val jsLambdaCount = jsLambda(
true,
100.toByte(),
200.toShort(),
'я',
300,
400L,
500.5f,
600.5,
"700",
create123Array(),
DC(800, 800),
val externalWithLambdas2Ref = ::externalWithLambdas2
val externalWithLambdas2RefCount = externalWithLambdas2Ref.invoke(
{ true },
{ 100.toByte() },
{ 200.toShort() },
{ 'я' },
{ 300 },
{ 400L },
{ 500.5f },
{ 600.5 },
{ "700" },
{ create123Array() },
{ DC(800, 800) },
{ it.y }
)
if (jsLambdaCount != 11)
return "Fail 3"
if (externalWithLambdas2RefCount != 11) return "Fail externalWithLambdas2"
val createJsLambdaRef = ::createJsLambda
for (jsLambda in arrayOf(createJsLambda(), createJsLambdaRef.invoke())) {
val jsLambdaCount = jsLambda(
true,
100.toByte(),
200.toShort(),
'я',
300,
400L,
500.5f,
600.5,
"700",
create123Array(),
DC(800, 800),
{ it.y }
)
if (jsLambdaCount != 11)
return "Fail 3"
}
complexHigherOrerTest()