mirror of
https://github.com/github/codeql.git
synced 2025-12-22 19:56:32 +01:00
Associate certain companion object fields with the parent class
Specifically `const`, `lateinit` and `@JvmField` properties get a static field which belongs to the containing class not the companion object, such that Java can address them via the containing class name rather than have to navigate a companion object pointer.
This commit is contained in:
@@ -135,7 +135,7 @@ open class KotlinFileExtractor(
|
||||
Unit
|
||||
}
|
||||
is IrField -> {
|
||||
val parentId = useDeclarationParent(declaration.parent, false)?.cast<DbReftype>()
|
||||
val parentId = useDeclarationParent(getFieldParent(declaration), false)?.cast<DbReftype>()
|
||||
if (parentId != null) {
|
||||
extractField(declaration, parentId)
|
||||
}
|
||||
@@ -829,10 +829,13 @@ open class KotlinFileExtractor(
|
||||
}
|
||||
|
||||
if (bf != null && extractBackingField) {
|
||||
val fieldId = extractField(bf, parentId)
|
||||
tw.writeKtPropertyBackingFields(id, fieldId)
|
||||
if (p.isDelegated) {
|
||||
tw.writeKtPropertyDelegates(id, fieldId)
|
||||
val fieldParentId = useDeclarationParent(getFieldParent(bf), false)
|
||||
if (fieldParentId != null) {
|
||||
val fieldId = extractField(bf, fieldParentId.cast())
|
||||
tw.writeKtPropertyBackingFields(id, fieldId)
|
||||
if (p.isDelegated) {
|
||||
tw.writeKtPropertyDelegates(id, fieldId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user