Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a6d0dc7

Browse files
committed
Kotlin: Small refactorings
1 parent e1cff50 commit a6d0dc7

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2525,12 +2525,11 @@ open class KotlinFileExtractor(
25252525
}
25262526

25272527
if (parent is IrFile) {
2528-
if (this.filePath == parent.path) {
2529-
val fileId = extractFileClass(parent)
2530-
tw.writeEnclInReftype(id, fileId)
2531-
} else {
2528+
if (this.filePath != parent.path) {
25322529
logger.warn(Severity.ErrorSevere, "Unexpected file parent found")
25332530
}
2531+
val fileId = extractFileClass(parent)
2532+
tw.writeEnclInReftype(id, fileId)
25342533
break
25352534
}
25362535

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ open class KotlinUsesExtractor(
116116
/**
117117
* Gets a KotlinFileExtractor based on this one, except it attributes locations to the file that declares the given class.
118118
*/
119-
private fun withSourceFileOfClass(cls: IrClass): KotlinFileExtractor {
119+
private fun withFileOfClass(cls: IrClass): KotlinFileExtractor {
120120
val clsFile = cls.fileOrNull
121121

122122
if (isExternalDeclaration(cls) || clsFile == null) {
@@ -252,7 +252,7 @@ open class KotlinUsesExtractor(
252252
if (argsIncludingOuterClasses == null || argsIncludingOuterClasses.isNotEmpty()) {
253253
// If this is a generic type instantiation or a raw type then it has no
254254
// source entity, so we need to extract it here
255-
val extractorWithCSource by lazy { this.withSourceFileOfClass(c) }
255+
val extractorWithCSource by lazy { this.withFileOfClass(c) }
256256

257257
if (!instanceSeenBefore) {
258258
extractorWithCSource.extractClassInstance(c, argsIncludingOuterClasses)

0 commit comments

Comments
 (0)