mirror of
				https://github.com/GayPizzaSpecifications/pork.git
				synced 2025-11-03 17:39:38 +00:00 
			
		
		
		
	fix bug with evaluator when calling varadic functions
This commit is contained in:
		@ -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 {
 | 
				
			||||||
 | 
				
			|||||||
@ -29,6 +29,8 @@ intellijPlatform {
 | 
				
			|||||||
      sinceBuild = "243"
 | 
					      sinceBuild = "243"
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  buildSearchableOptions.set(false)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
porkAst {
 | 
					porkAst {
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user