@@ -298,9 +298,23 @@ open class KotlinUsesExtractor(
298
298
}
299
299
}
300
300
301
+ private fun extractParentExternalClassLater (d : IrDeclaration ) {
302
+ val p = d.parent
303
+ when (p) {
304
+ is IrClass -> extractExternalClassLater(p)
305
+ is IrExternalPackageFragment -> {
306
+ // The parent is a (multi)file class. We don't need to
307
+ // extract it separately.
308
+ }
309
+ else -> {
310
+ logger.warn(" Unexpected parent type ${p.javaClass} for external file class member" )
311
+ }
312
+ }
313
+ }
314
+
301
315
private fun extractPropertyLaterIfExternalFileMember (p : IrProperty ) {
302
316
if (isExternalFileClassMember(p)) {
303
- extractExternalClassLater(p.parentAsClass )
317
+ extractParentExternalClassLater(p )
304
318
val signature = getTrapFileSignature(p)
305
319
dependencyCollector?.addDependency(p, signature)
306
320
externalClassExtractor.extractLater(p, signature)
@@ -309,7 +323,7 @@ open class KotlinUsesExtractor(
309
323
310
324
private fun extractFieldLaterIfExternalFileMember (f : IrField ) {
311
325
if (isExternalFileClassMember(f)) {
312
- extractExternalClassLater(f.parentAsClass )
326
+ extractParentExternalClassLater(f )
313
327
val signature = getTrapFileSignature(f)
314
328
dependencyCollector?.addDependency(f, signature)
315
329
externalClassExtractor.extractLater(f, signature)
@@ -318,17 +332,7 @@ open class KotlinUsesExtractor(
318
332
319
333
private fun extractFunctionLaterIfExternalFileMember (f : IrFunction ) {
320
334
if (isExternalFileClassMember(f)) {
321
- val p = f.parent
322
- when (p) {
323
- is IrClass -> extractExternalClassLater(p)
324
- is IrExternalPackageFragment -> {
325
- // The parent is a (multi)file class. We don't need
326
- // extract it separately.
327
- }
328
- else -> {
329
- logger.warn(" Unexpected parent type ${p.javaClass} for external file class member" )
330
- }
331
- }
335
+ extractParentExternalClassLater(f)
332
336
(f as ? IrSimpleFunction )?.correspondingPropertySymbol?.let {
333
337
extractPropertyLaterIfExternalFileMember(it.owner)
334
338
// No need to extract the function specifically, as the property's
0 commit comments