File tree Expand file tree Collapse file tree
java/kotlin-extractor/src/main/kotlin/utils/versions/v_2_4_0 Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,9 +5,15 @@ import org.jetbrains.kotlin.ir.declarations.IrParameterKind
55import org.jetbrains.kotlin.ir.declarations.IrValueParameter
66
77fun parameterIndexExcludingReceivers (vp : IrValueParameter ): Int {
8- val offset =
9- (vp.parent as ? IrFunction )?.let { f ->
10- f.parameters.count { it.kind == IrParameterKind .DispatchReceiver || it.kind == IrParameterKind .ExtensionReceiver || it.kind == IrParameterKind .Context }
11- } ? : 0
12- return vp.indexInParameters - offset
8+ if (
9+ vp.kind == IrParameterKind .DispatchReceiver ||
10+ vp.kind == IrParameterKind .ExtensionReceiver
11+ ) {
12+ return - 1
13+ }
14+ return (vp.parent as ? IrFunction )
15+ ?.parameters
16+ ?.take(vp.indexInParameters)
17+ ?.count { it.kind == IrParameterKind .Context || it.kind == IrParameterKind .Regular }
18+ ? : vp.indexInParameters
1319}
You can’t perform that action at this time.
0 commit comments