Kotlin: Don't extract a name for a '_' parameter

I can't reproduce the exact circumstances, but these sometimes get "<anonymous parameter X>" names and sometimes get "$noName_X" names. Whichever way, avoiding extracting a synthetic name seems safest; anyone finding the .class file and not reading the metadata indicating it came from a `_` will extract the binary name selected, or else QL will
invent a name.
This commit is contained in:
Chris Smowton
2022-07-14 16:36:26 +01:00
parent 7fbe4f8547
commit d4b0163c4c
5 changed files with 19 additions and 6 deletions

View File

@@ -642,7 +642,7 @@ open class KotlinFileExtractor(
if (extractTypeAccess) {
extractTypeAccessRecursive(substitutedType, location, id, -1)
}
val syntheticParameterNames = (vp.parent as? IrFunction)?.let { hasSynthesizedParameterNames(it) } ?: true
val syntheticParameterNames = vp.origin == IrDeclarationOrigin.UNDERSCORE_PARAMETER || ((vp.parent as? IrFunction)?.let { hasSynthesizedParameterNames(it) } ?: true)
return extractValueParameter(id, substitutedType, vp.name.asString(), location, parent, idx, useValueParameter(vp, parentSourceDeclaration), vp.isVararg, syntheticParameterNames)
}
}