Apply code review findings

This commit is contained in:
Tamas Vajk
2024-10-09 16:02:54 +02:00
parent a471fa004a
commit e82b1762c0
2 changed files with 7 additions and 2 deletions

View File

@@ -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<KtProperty, Label<out DbLocalvar>> =
mutableMapOf<KtProperty, Label<out DbLocalvar>>()
@@ -167,9 +168,12 @@ abstract class TrapWriter(
}
}
/*
OLD: KE1
fun getExistingVariableLabelFor(v: KtProperty): Label<out DbLocalvar>? {
return variableLabelMapping[v]
}
*/
/**
* This returns a label for the location described by its arguments. Typically users will not

View File

@@ -2383,7 +2383,7 @@ private fun KotlinFileExtractor.extractVariableExpr(
parent: Label<out DbExprparent>,
idx: Int,
enclosingStmt: Label<out DbStmt>,
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) {