mirror of
https://github.com/GayPizzaSpecifications/pork.git
synced 2025-08-02 12:50:55 +00:00
fix bug with evaluator when calling varadic functions
This commit is contained in:
parent
60c7b2d4be
commit
8d8866c26c
@ -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 {
|
||||
|
@ -29,6 +29,8 @@ intellijPlatform {
|
||||
sinceBuild = "243"
|
||||
}
|
||||
}
|
||||
|
||||
buildSearchableOptions.set(false)
|
||||
}
|
||||
|
||||
porkAst {
|
||||
|
Loading…
Reference in New Issue
Block a user