mirror of
https://github.com/github/codeql.git
synced 2025-12-21 03:06:31 +01:00
Kotlin: Small refactorings
This commit is contained in:
@@ -2525,12 +2525,11 @@ open class KotlinFileExtractor(
|
||||
}
|
||||
|
||||
if (parent is IrFile) {
|
||||
if (this.filePath == parent.path) {
|
||||
val fileId = extractFileClass(parent)
|
||||
tw.writeEnclInReftype(id, fileId)
|
||||
} else {
|
||||
if (this.filePath != parent.path) {
|
||||
logger.warn(Severity.ErrorSevere, "Unexpected file parent found")
|
||||
}
|
||||
val fileId = extractFileClass(parent)
|
||||
tw.writeEnclInReftype(id, fileId)
|
||||
break
|
||||
}
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ open class KotlinUsesExtractor(
|
||||
/**
|
||||
* Gets a KotlinFileExtractor based on this one, except it attributes locations to the file that declares the given class.
|
||||
*/
|
||||
private fun withSourceFileOfClass(cls: IrClass): KotlinFileExtractor {
|
||||
private fun withFileOfClass(cls: IrClass): KotlinFileExtractor {
|
||||
val clsFile = cls.fileOrNull
|
||||
|
||||
if (isExternalDeclaration(cls) || clsFile == null) {
|
||||
@@ -252,7 +252,7 @@ open class KotlinUsesExtractor(
|
||||
if (argsIncludingOuterClasses == null || argsIncludingOuterClasses.isNotEmpty()) {
|
||||
// If this is a generic type instantiation or a raw type then it has no
|
||||
// source entity, so we need to extract it here
|
||||
val extractorWithCSource by lazy { this.withSourceFileOfClass(c) }
|
||||
val extractorWithCSource by lazy { this.withFileOfClass(c) }
|
||||
|
||||
if (!instanceSeenBefore) {
|
||||
extractorWithCSource.extractClassInstance(c, argsIncludingOuterClasses)
|
||||
|
||||
Reference in New Issue
Block a user