JS: inliner supports extra argument caused by suspend conversions
This commit is contained in:
Vendored
-1
@@ -2,7 +2,6 @@
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
import helpers.*
|
||||
import kotlin.coroutines.*
|
||||
|
||||
@@ -46,9 +46,17 @@ private constructor(
|
||||
}
|
||||
|
||||
private fun process() {
|
||||
val arguments = getArguments()
|
||||
var arguments = getArguments()
|
||||
val parameters = getParameters()
|
||||
|
||||
if (arguments.size > parameters.size) {
|
||||
// Due to suspend conversions it is possible to have an extra argument, e.g. `fn($this$)` for `function fn() {...}`
|
||||
// In such cases all missing arguments for default parameters are passed as `void 0` explicitly.
|
||||
// Thus it is safe to drop it.
|
||||
assert(arguments.size == parameters.size + 1) { "arguments.size (${arguments.size}) may only exceed the parameters.size (${parameters.size}) by one and only in case of suspend conversions" }
|
||||
arguments = arguments.subList(0, parameters.size)
|
||||
}
|
||||
|
||||
removeDefaultInitializers(arguments, parameters, body)
|
||||
aliasArgumentsIfNeeded(namingContext, arguments, parameters, call.source)
|
||||
renameLocalNames(namingContext, invokedFunction)
|
||||
|
||||
Reference in New Issue
Block a user