mirror of
https://github.com/github/codeql.git
synced 2025-12-22 03:36:30 +01:00
Comment extraction: don't treat anonymous classes differently
This commit is contained in:
@@ -470,14 +470,6 @@ open class KotlinUsesExtractor(
|
||||
)
|
||||
}
|
||||
|
||||
fun getExistingAnonymousClassLabel(c: IrClass): Label<out DbType>? {
|
||||
if (!c.isAnonymousObject){
|
||||
return null
|
||||
}
|
||||
|
||||
return tw.lm.anonymousTypeMapping[c]?.javaResult?.id
|
||||
}
|
||||
|
||||
fun fakeKotlinType(): Label<out DbKt_type> {
|
||||
val fakeKotlinPackageId: Label<DbPackage> = tw.getLabelFor("@\"FakeKotlinPackage\"", {
|
||||
tw.writePackages(it, "fake.kotlin")
|
||||
|
||||
@@ -127,12 +127,7 @@ class CommentExtractor(private val fileExtractor: KotlinFileExtractor, private v
|
||||
// local functions are not named globally, so we need to get them from the local function label cache
|
||||
label = "local function ${element.name.asString()}"
|
||||
fileExtractor.getExistingLocallyVisibleFunctionLabel(element)
|
||||
} else if (element is IrClass && element.isAnonymousObject) {
|
||||
// anonymous objects are not named globally, so we need to get them from the cache
|
||||
label = "anonymous class ${element.name.asString()}"
|
||||
fileExtractor.getExistingAnonymousClassLabel(element)
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
label = getLabelForNamedElement(element) ?: return null
|
||||
tw.getExistingLabelFor<DbTop>(label)
|
||||
}
|
||||
@@ -145,12 +140,7 @@ class CommentExtractor(private val fileExtractor: KotlinFileExtractor, private v
|
||||
|
||||
private fun getLabelForNamedElement(element: IrElement) : String? {
|
||||
when (element) {
|
||||
is IrClass ->
|
||||
return if (element.isAnonymousObject) {
|
||||
null
|
||||
} else {
|
||||
fileExtractor.getClassLabel(element, listOf()).classLabel
|
||||
}
|
||||
is IrClass -> return fileExtractor.getClassLabel(element, listOf()).classLabel
|
||||
is IrTypeParameter -> return fileExtractor.getTypeParameterLabel(element)
|
||||
is IrFunction -> {
|
||||
return if (element.isLocalFunction()) {
|
||||
|
||||
Reference in New Issue
Block a user