mirror of
https://github.com/github/codeql.git
synced 2026-05-24 16:17:07 +02:00
Apply code review findings
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user