mirror of
https://github.com/github/codeql.git
synced 2025-12-24 04:36:35 +01:00
Kotlin: Remove the last uses of fakeLabel
This commit is contained in:
@@ -121,14 +121,19 @@ open class KotlinUsesExtractor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun extractErrorType(): TypeResults {
|
private fun extractJavaErrorType(): TypeResult<DbErrortype> {
|
||||||
val typeId = tw.getLabelFor<DbErrortype>("@\"errorType\"") {
|
val typeId = tw.getLabelFor<DbErrortype>("@\"errorType\"") {
|
||||||
tw.writeError_type(it)
|
tw.writeError_type(it)
|
||||||
}
|
}
|
||||||
|
return TypeResult(typeId, null, "<CodeQL error type>")
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun extractErrorType(): TypeResults {
|
||||||
|
val javaResult = extractJavaErrorType()
|
||||||
val kotlinTypeId = tw.getLabelFor<DbKt_nullable_type>("@\"errorKotlinType\"") {
|
val kotlinTypeId = tw.getLabelFor<DbKt_nullable_type>("@\"errorKotlinType\"") {
|
||||||
tw.writeKt_nullable_types(it, typeId)
|
tw.writeKt_nullable_types(it, javaResult.id)
|
||||||
}
|
}
|
||||||
return TypeResults(TypeResult(typeId, null, "<CodeQL error type>"),
|
return TypeResults(javaResult,
|
||||||
TypeResult(kotlinTypeId, null, "<CodeQL error type>"))
|
TypeResult(kotlinTypeId, null, "<CodeQL error type>"))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -719,7 +724,7 @@ open class KotlinUsesExtractor(
|
|||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
logger.error("Unrecognised IrSimpleType: " + s.javaClass + ": " + s.render())
|
logger.error("Unrecognised IrSimpleType: " + s.javaClass + ": " + s.render())
|
||||||
return TypeResults(TypeResult(fakeLabel(), "unknown", "unknown"), TypeResult(fakeLabel(), "unknown", "unknown"))
|
return extractErrorType()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1276,7 +1281,7 @@ open class KotlinUsesExtractor(
|
|||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
logger.error("Unexpected type argument.")
|
logger.error("Unexpected type argument.")
|
||||||
return TypeResult(fakeLabel(), "unknown", "unknown")
|
return extractJavaErrorType()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,15 +29,3 @@ class IntLabel<T>(val i: Int): Label<T> {
|
|||||||
class StringLabel<T>(val name: String): Label<T> {
|
class StringLabel<T>(val name: String): Label<T> {
|
||||||
override fun toString(): String = "#$name"
|
override fun toString(): String = "#$name"
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Remove this and all of its uses
|
|
||||||
fun <T> fakeLabel(): Label<T> {
|
|
||||||
if (false) {
|
|
||||||
println("Fake label")
|
|
||||||
} else {
|
|
||||||
val sw = StringWriter()
|
|
||||||
Exception().printStackTrace(PrintWriter(sw))
|
|
||||||
println("Fake label from:\n$sw")
|
|
||||||
}
|
|
||||||
return IntLabel(0)
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user