mirror of
https://github.com/github/codeql.git
synced 2025-12-22 03:36:30 +01:00
Don't extract error expressions when a default value is missing
This is a shortcoming of the Kotlin extractor, but at least this way we don't introduce an inconsistency if the annotation is later seen from .kt source or by the Java extractor
This commit is contained in:
@@ -582,17 +582,9 @@ open class KotlinFileExtractor(
|
||||
}
|
||||
// is IrErrorExpression
|
||||
// null
|
||||
else -> {
|
||||
val eId = tw.getFreshIdLabel<DbErrorexpr>()
|
||||
val type = useType(v?.type ?: pluginContext.irBuiltIns.unitType)
|
||||
tw.writeExprs_errorexpr(eId, type.javaResult.id, parent, idx)
|
||||
tw.writeExprsKotlinType(eId, type.kotlinResult.id)
|
||||
|
||||
if (v != null) {
|
||||
tw.writeHasLocation(eId, tw.getLocation(v))
|
||||
}
|
||||
eId
|
||||
}
|
||||
// Note: emitting an ErrorExpr here would induce an inconsistency if this annotation is later seen from source or by the Java extractor,
|
||||
// in both of which cases the real value will get extracted.
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user