Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion java/kotlin-extractor/src/main/kotlin/LinesOfCode.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class LinesOfCode(
val tw: FileTrapWriter,
val file: IrFile
) {
val psi2Ir = getPsi2Ir(logger).also {
val psi2Ir = getPsi2Ir().also {
if (it == null) {
logger.warn("Lines of code will not be populated as Kotlin version is too old (${KotlinCompilerVersion.getVersion()})")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class CommentExtractor(private val fileExtractor: KotlinFileExtractor, private v
private val logger = fileExtractor.logger

fun extract() {
val psi2Ir = getPsi2Ir(logger)
val psi2Ir = getPsi2Ir()
if (psi2Ir == null) {
logger.warn("Comments will not be extracted as Kotlin version is too old (${KotlinCompilerVersion.getVersion()})")
return
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
package com.github.codeql.utils.versions

import com.github.codeql.FileLogger

fun getPsi2Ir(@Suppress("UNUSED_PARAMETER") logger: FileLogger): Psi2IrFacade? = null
fun getPsi2Ir(): Psi2IrFacade? = null
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package com.github.codeql.utils.versions

import com.github.codeql.FileLogger
import com.intellij.psi.PsiElement
import org.jetbrains.kotlin.backend.common.psi.PsiSourceManager
import org.jetbrains.kotlin.backend.jvm.ir.getKtFile
import org.jetbrains.kotlin.ir.IrElement
import org.jetbrains.kotlin.ir.declarations.IrFile
import org.jetbrains.kotlin.psi.KtFile

fun getPsi2Ir(logger: FileLogger): Psi2IrFacade? = Psi2Ir(logger)
fun getPsi2Ir(): Psi2IrFacade? = Psi2Ir()

private class Psi2Ir(private val logger: FileLogger): Psi2IrFacade {
private class Psi2Ir(): Psi2IrFacade {
override fun getKtFile(irFile: IrFile): KtFile? {
return irFile.getKtFile()
}
Expand Down