Kotlin: Move extractFileContents into KotlinFileExtractor

This commit is contained in:
Ian Lynagh
2022-01-13 16:15:24 +00:00
parent d43efd4cc7
commit c1c4e4f86c
3 changed files with 12 additions and 12 deletions

View File

@@ -1,5 +1,6 @@
package com.github.codeql
import com.github.codeql.comments.CommentExtractor
import com.github.codeql.utils.TypeSubstitution
import com.github.codeql.utils.versions.functionN
import com.github.codeql.utils.substituteTypeAndArguments
@@ -34,6 +35,16 @@ open class KotlinFileExtractor(
genericSpecialisationsExtracted: MutableSet<String>
): KotlinUsesExtractor(logger, tw, dependencyCollector, externalClassExtractor, primitiveTypeMapping, pluginContext, genericSpecialisationsExtracted) {
fun extractFileContents(file: IrFile, id: Label<DbFile>) {
val locId = tw.getWholeFileLocation()
val pkg = file.fqName.asString()
val pkgId = extractPackage(pkg)
tw.writeHasLocation(id, locId)
tw.writeCupackage(id, pkgId)
file.declarations.map { extractDeclaration(it) }
CommentExtractor(this, file).extract()
}
fun extractDeclaration(declaration: IrDeclaration) {
when (declaration) {
is IrClass -> {