Skip to content

Commit e82b176

Browse files
committed
Apply code review findings
1 parent a471fa0 commit e82b176

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

java/kotlin-extractor2/src/main/kotlin/TrapWriter.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ abstract class TrapWriter(
152152
* same variable may be referred to from distant places in the IR, so we need a way to find out
153153
* which label is used for a given local variable. This information is stored in this mapping.
154154
*/
155+
// TODO: This should be in a subclass so that DiagnosticTrapWriter doesn't include it, as it is not threadsafe
155156
private val variableLabelMapping: MutableMap<KtProperty, Label<out DbLocalvar>> =
156157
mutableMapOf<KtProperty, Label<out DbLocalvar>>()
157158

@@ -167,9 +168,12 @@ abstract class TrapWriter(
167168
}
168169
}
169170

171+
/*
172+
OLD: KE1
170173
fun getExistingVariableLabelFor(v: KtProperty): Label<out DbLocalvar>? {
171174
return variableLabelMapping[v]
172175
}
176+
*/
173177

174178
/**
175179
* This returns a label for the location described by its arguments. Typically users will not

java/kotlin-extractor2/src/main/kotlin/entities/Expression.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2383,7 +2383,7 @@ private fun KotlinFileExtractor.extractVariableExpr(
23832383
parent: Label<out DbExprparent>,
23842384
idx: Int,
23852385
enclosingStmt: Label<out DbStmt>,
2386-
extractInitializer: Boolean = true
2386+
//extractInitializer: Boolean = true // OLD KE1
23872387
) {
23882388
with("variable expr", v) {
23892389
val varId = useVariable(v)
@@ -2397,7 +2397,8 @@ private fun KotlinFileExtractor.extractVariableExpr(
23972397
tw.writeExprsKotlinType(exprId, type.kotlinResult.id)
23982398
extractExprContext(exprId, locId, callable, enclosingStmt)
23992399
val i = v.initializer
2400-
if (i != null && extractInitializer) {
2400+
//OLD KE1: if (i != null && extractInitializer) {
2401+
if (i != null) {
24012402
extractExpressionExpr(i, callable, exprId, 0, enclosingStmt)
24022403
}
24032404
if (!v.isVar) {

0 commit comments

Comments
 (0)