Skip to content

Commit 0d97c1c

Browse files
authored
Merge pull request github#13837 from igfoo/igfoo/nullFunLabel
Kotlin: Pass on a parentId and remove some redundant braces
2 parents e62ec88 + 01a512b commit 0d97c1c

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ open class KotlinFileExtractor(
552552
logger.warnElement("Expected annotation property to define a getter", prop)
553553
} else {
554554
val getterId = useFunction<DbMethod>(getter)
555-
val exprId = extractAnnotationValueExpression(v, id, i, "{${getterId}}", getter.returnType, extractEnumTypeAccesses)
555+
val exprId = extractAnnotationValueExpression(v, id, i, "{$getterId}", getter.returnType, extractEnumTypeAccesses)
556556
if (exprId != null) {
557557
tw.writeAnnotValue(id, getterId, exprId)
558558
}
@@ -587,7 +587,7 @@ open class KotlinFileExtractor(
587587
extractAnnotation(v, parent, idx, extractEnumTypeAccesses, contextLabel)
588588
}
589589
is IrVararg -> {
590-
tw.getLabelFor<DbArrayinit>("@\"annotationarray;{${parent}};$contextLabel\"").also { arrayId ->
590+
tw.getLabelFor<DbArrayinit>("@\"annotationarray;{$parent};$contextLabel\"").also { arrayId ->
591591
// Use the context type (i.e., the type the annotation expects, not the actual type of the array)
592592
// because the Java extractor fills in array types using the same technique. These should only
593593
// differ for generic annotations.
@@ -1193,7 +1193,7 @@ open class KotlinFileExtractor(
11931193
// n + o'th parameter, where `o` is the parameter offset caused by adding any dispatch receiver to the parameter list.
11941194
// Note we don't need to add the extension receiver here because `useValueParameter` always assumes an extension receiver
11951195
// will be prepended if one exists.
1196-
val realFunctionId = useFunction<DbCallable>(f)
1196+
val realFunctionId = useFunction<DbCallable>(f, parentId, null)
11971197
DeclarationStackAdjuster(f, OverriddenFunctionAttributes(id, id, locId, nonSyntheticParams, typeParameters = listOf(), isStatic = true)).use {
11981198
val realParamsVarId = getValueParameterLabel(id, parameterTypes.size - 2)
11991199
val intType = pluginContext.irBuiltIns.intType

java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ open class KotlinUsesExtractor(
612612
val componentTypeLabel = recInfo.componentTypeResults.javaResult.id
613613
val dimensions = recInfo.dimensions + 1
614614

615-
val id = tw.getLabelFor<DbArray>("@\"array;$dimensions;{${elementTypeLabel}}\"") {
615+
val id = tw.getLabelFor<DbArray>("@\"array;$dimensions;{$elementTypeLabel}\"") {
616616
tw.writeArrays(
617617
it,
618618
javaShortName,
@@ -1141,7 +1141,7 @@ open class KotlinUsesExtractor(
11411141
// method (and presumably that disambiguation is never needed when the method belongs to a parameterized
11421142
// instance of a generic class), but as of now I don't know when the raw method would be referred to.
11431143
val typeArgSuffix = if (functionTypeParameters.isNotEmpty() && classTypeArgsIncludingOuterClasses.isNullOrEmpty()) "<${functionTypeParameters.size}>" else "";
1144-
return "@\"$prefix;{$parentId}.$name($paramTypeIds){$returnTypeId}${typeArgSuffix}\""
1144+
return "@\"$prefix;{$parentId}.$name($paramTypeIds){$returnTypeId}$typeArgSuffix\""
11451145
}
11461146

11471147
val javaLangClass by lazy { referenceExternalClass("java.lang.Class") }
@@ -1672,7 +1672,7 @@ open class KotlinUsesExtractor(
16721672
// clashing trap labels. These are always private, so we can just make up a label without
16731673
// worrying about their names as seen from Java.
16741674
val extensionPropertyDiscriminator = getExtensionReceiverType(f)?.let { "extension;${useType(it).javaResult.id}" } ?: ""
1675-
return "@\"field;{$parentId};${extensionPropertyDiscriminator}${f.name.asString()}\""
1675+
return "@\"field;{$parentId};$extensionPropertyDiscriminator${f.name.asString()}\""
16761676
}
16771677

16781678
fun useField(f: IrField): Label<out DbField> =

0 commit comments

Comments
 (0)