fix bug with evaluator when calling varadic functions

This commit is contained in:
alex committed 2025-07-26 00:07:10 -07:00
1 parent 60c7b2d4be
commit 8d8866c26c
2 files changed
+23 -1

No files matched your search

@@ -12,7 +12,27 @@ class AdaptedNativeProvider(val provider: NativeProvider) : ExpandedNativeProvid
inside: SlabContext inside: SlabContext
): CallableFunction { ): CallableFunction {
val function = provider.provideNativeFunction(definitions) val function = provider.provideNativeFunction(definitions)
return CallableFunction { args, _ -> function.invoke(args) } return CallableFunction { args, _ ->
val argumentsWithLists = mutableListOf<Any>()
for ((index, spec) in arguments.withIndex()) {
if (spec.multiple) {
val list = if (index > args.size - 1) {
listOf()
} else {
args.subList(index, args.size)
}
argumentsWithLists.add(list)
break
}
if (index > args.size - 1) {
break
}
val value = args[index]
argumentsWithLists.add(value)
}
function.invoke(argumentsWithLists)
}
} }
override fun provideNativeFunction(definitions: List<String>): NativeFunction { override fun provideNativeFunction(definitions: List<String>): NativeFunction {
+2
View File
@@ -29,6 +29,8 @@ intellijPlatform {
sinceBuild = "243" sinceBuild = "243"
} }
} }
buildSearchableOptions.set(false)
} }
porkAst { porkAst {