fix bug with evaluator when calling varadic functions

This commit is contained in:
Alex Zenla 2025-07-26 00:07:10 -07:00
parent 60c7b2d4be
commit 8d8866c26c
No known key found for this signature in database
GPG Key ID: 067B238899B51269
2 changed files with 23 additions and 1 deletions

View File

@ -12,7 +12,27 @@ class AdaptedNativeProvider(val provider: NativeProvider) : ExpandedNativeProvid
inside: SlabContext
): CallableFunction {
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 {

View File

@ -29,6 +29,8 @@ intellijPlatform {
sinceBuild = "243"
}
}
buildSearchableOptions.set(false)
}
porkAst {