From e82b1762c096abee2424da0d584c14af6ea0eca9 Mon Sep 17 00:00:00 2001 From: Tamas Vajk Date: Wed, 9 Oct 2024 16:02:54 +0200 Subject: [PATCH] Apply code review findings --- java/kotlin-extractor2/src/main/kotlin/TrapWriter.kt | 4 ++++ .../kotlin-extractor2/src/main/kotlin/entities/Expression.kt | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/java/kotlin-extractor2/src/main/kotlin/TrapWriter.kt b/java/kotlin-extractor2/src/main/kotlin/TrapWriter.kt index e6dd43be80d..2a2610c6a09 100644 --- a/java/kotlin-extractor2/src/main/kotlin/TrapWriter.kt +++ b/java/kotlin-extractor2/src/main/kotlin/TrapWriter.kt @@ -152,6 +152,7 @@ abstract class TrapWriter( * same variable may be referred to from distant places in the IR, so we need a way to find out * which label is used for a given local variable. This information is stored in this mapping. */ + // TODO: This should be in a subclass so that DiagnosticTrapWriter doesn't include it, as it is not threadsafe private val variableLabelMapping: MutableMap> = mutableMapOf>() @@ -167,9 +168,12 @@ abstract class TrapWriter( } } + /* + OLD: KE1 fun getExistingVariableLabelFor(v: KtProperty): Label? { return variableLabelMapping[v] } + */ /** * This returns a label for the location described by its arguments. Typically users will not diff --git a/java/kotlin-extractor2/src/main/kotlin/entities/Expression.kt b/java/kotlin-extractor2/src/main/kotlin/entities/Expression.kt index c563d23dd43..4592059b177 100644 --- a/java/kotlin-extractor2/src/main/kotlin/entities/Expression.kt +++ b/java/kotlin-extractor2/src/main/kotlin/entities/Expression.kt @@ -2383,7 +2383,7 @@ private fun KotlinFileExtractor.extractVariableExpr( parent: Label, idx: Int, enclosingStmt: Label, - extractInitializer: Boolean = true + //extractInitializer: Boolean = true // OLD KE1 ) { with("variable expr", v) { val varId = useVariable(v) @@ -2397,7 +2397,8 @@ private fun KotlinFileExtractor.extractVariableExpr( tw.writeExprsKotlinType(exprId, type.kotlinResult.id) extractExprContext(exprId, locId, callable, enclosingStmt) val i = v.initializer - if (i != null && extractInitializer) { + //OLD KE1: if (i != null && extractInitializer) { + if (i != null) { extractExpressionExpr(i, callable, exprId, 0, enclosingStmt) } if (!v.isVar) {