diff --git a/java/kotlin-extractor2/src/main/kotlin/KotlinExtractor.kt b/java/kotlin-extractor2/src/main/kotlin/KotlinExtractor.kt index e2285471088..ed74517f7cf 100644 --- a/java/kotlin-extractor2/src/main/kotlin/KotlinExtractor.kt +++ b/java/kotlin-extractor2/src/main/kotlin/KotlinExtractor.kt @@ -65,7 +65,7 @@ fun main(args: Array) { } @OptIn(KaAnalysisApiInternals::class) -fun runExtractor(args: Array) { +private fun runExtractor(args: Array) { val startTimeMs = System.currentTimeMillis() val invocationTrapFile = args[0] @@ -169,7 +169,7 @@ OLD: KE1 } } -fun doAnalysis( +private fun doAnalysis( compression: Compression, trapDir: File, srcDir: File, @@ -308,45 +308,6 @@ fun doAnalysis( } } -context (KaSession) -fun dumpFunction(f: KtFunction) { - println("=== Have function") - println(f) - println(f.parent) - val block = f.getBodyExpression() as KtBlockExpression - for (p: KtExpression in block.getStatements()) { - if (p is KtProperty) { - dumpProperty(p) - } - } -} - -context (KaSession) -fun dumpProperty(p: KtProperty) { - println("Got property ${p.name}") - val i = p.getInitializer()!! - val t = i.expressionType!! - println(" Location: ${location(i)}") - println(" Initializer type $t (${t.javaClass})") - if (i is KtCallExpression) { - println(" Call info: ${i.resolveToCall()}") - } -} - -fun location(e: KtElement): String { - val range = e.getTextRange() - val document = e.getContainingFile().getViewProvider().getDocument() - val start = showOffset(document, range.getStartOffset(), 1) - val end = showOffset(document, range.getEndOffset(), 0) - return "$start-$end" -} - -fun showOffset(document: Document, o: Int, colFudge: Int): String { - val line = document.getLineNumber(o) - val column = o - document.getLineStartOffset(line) - return "${line + 1}:${column + colFudge}" -} - /* OLD: KE1 import com.github.codeql.utils.versions.usesK2 @@ -509,23 +470,6 @@ private fun doFile( globalExtensionState: KotlinExtractorGlobalState */ ) { - // TODO: Testing - val c = srcFile.getDeclarations()[0] - if (c is KtClass) { - for (d: KtDeclaration in c.getDeclarations()) { - if (d is KtFunction) { - if (d.name == "f") { - dumpFunction(d) - } - } - } - } - if (c is KtFunction) { - if (c.name == "test") { - dumpFunction(c) - } - } - val srcFilePath = srcFile.virtualFilePath val logger = FileLogger(loggerBase, fileDiagnosticTrapWriter, fileNumber) logger.info("Extracting file $srcFilePath") diff --git a/java/kotlin-extractor2/src/main/kotlin/entities/Expression.kt b/java/kotlin-extractor2/src/main/kotlin/entities/Expression.kt index 7f085db2b6f..265dd273a65 100644 --- a/java/kotlin-extractor2/src/main/kotlin/entities/Expression.kt +++ b/java/kotlin-extractor2/src/main/kotlin/entities/Expression.kt @@ -2817,7 +2817,7 @@ private fun KotlinFileExtractor.useVariable(v: KaVariableSymbol): Label, stmtExprParent: StmtExprParent