@@ -16,6 +16,7 @@ import org.jetbrains.kotlin.ir.declarations.IrDeclarationParent
1616import org.jetbrains.kotlin.ir.declarations.IrFile
1717import org.jetbrains.kotlin.ir.declarations.IrFunction
1818import org.jetbrains.kotlin.ir.declarations.IrValueParameter
19+ import org.jetbrains.kotlin.ir.declarations.IrProperty
1920import org.jetbrains.kotlin.ir.util.dump
2021import org.jetbrains.kotlin.ir.util.IdSignature
2122import org.jetbrains.kotlin.ir.util.packageFqName
@@ -148,6 +149,7 @@ class KotlinFileExtractor(val tw: TrapWriter) {
148149 when (declaration) {
149150 is IrClass -> extractClass(declaration)
150151 is IrFunction -> extractFunction(declaration, parentid)
152+ is IrProperty -> extractProperty(declaration, parentid)
151153 else -> extractorBug(" Unrecognised IrDeclaration: " + declaration.javaClass)
152154 }
153155 }
@@ -266,6 +268,26 @@ class KotlinFileExtractor(val tw: TrapWriter) {
266268 }
267269 }
268270
271+ fun useProperty (p : IrProperty ): Label <out DbField > {
272+ val parentId = useDeclarationParent(p.parent)
273+ val label = " @\" field;{$parentId };${p.name.asString()} \" "
274+ val id: Label <DbField > = tw.getLabelFor(label)
275+ return id
276+ }
277+
278+ fun extractProperty (p : IrProperty , parentid : Label <out DbPackage_or_reftype >) {
279+ val bf = p.backingField
280+ if (bf == null ) {
281+ extractorBug(" IrProperty without backing field" )
282+ } else {
283+ val id = useProperty(p)
284+ val locId = tw.getLocation(p.startOffset, p.endOffset)
285+ val typeId = useType(bf.type)
286+ tw.writeFields(id, p.name.asString(), typeId, parentid, id)
287+ tw.writeHasLocation(id, locId)
288+ }
289+ }
290+
269291 fun extractBody (b : IrBody , callable : Label <out DbCallable >) {
270292 when (b) {
271293 is IrBlockBody -> extractBlockBody(b, callable, callable, 0 )
0 commit comments