@@ -4,7 +4,7 @@ import com.github.codeql.comments.CommentExtractor
4
4
import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension
5
5
import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext
6
6
import org.jetbrains.kotlin.builtins.jvm.JavaToKotlinClassMap
7
- import org.jetbrains.kotlin.descriptors.ClassKind
7
+ import org.jetbrains.kotlin.descriptors.*
8
8
import org.jetbrains.kotlin.ir.IrElement
9
9
import org.jetbrains.kotlin.ir.IrStatement
10
10
import org.jetbrains.kotlin.ir.declarations.*
@@ -494,7 +494,8 @@ open class KotlinUsesExtractor(
494
494
tw.writeIsParameterized(id)
495
495
val unbound = useClassSource(c)
496
496
tw.writeErasure(id, unbound)
497
- extractClassCommon(c, id)
497
+ extractClassModifiers(c, id)
498
+ extractClassSupertypes(c, id)
498
499
499
500
return id
500
501
}
@@ -571,7 +572,7 @@ open class KotlinUsesExtractor(
571
572
dimensions,
572
573
componentTypeLabel)
573
574
574
- extractClassCommon (arrayType.classifier.owner as IrClass , it)
575
+ extractClassSupertypes (arrayType.classifier.owner as IrClass , it)
575
576
576
577
// array.length
577
578
val length = tw.getLabelFor<DbField >(" @\" field;{$it };length\" " )
@@ -862,7 +863,21 @@ class X {
862
863
return tw.getLabelFor(l)
863
864
}
864
865
865
- fun extractClassCommon (c : IrClass , id : Label <out DbReftype >) {
866
+ fun extractModifier (m : String ): Label <DbModifier > {
867
+ val modifierLabel = " @\" modifier;$m \" "
868
+ val id: Label <DbModifier > = tw.getLabelFor(modifierLabel, {
869
+ tw.writeModifiers(it, m)
870
+ })
871
+ return id
872
+ }
873
+
874
+ fun extractClassModifiers (c : IrClass , id : Label <out DbClassorinterface >) {
875
+ if (c.modality == Modality .ABSTRACT ) {
876
+ tw.writeHasModifier(id, extractModifier(" abstract" ))
877
+ }
878
+ }
879
+
880
+ fun extractClassSupertypes (c : IrClass , id : Label <out DbReftype >) {
866
881
for (t in c.superTypes) {
867
882
when (t) {
868
883
is IrSimpleType -> {
@@ -1123,7 +1138,8 @@ open class KotlinFileExtractor(
1123
1138
tw.writeClass_object(id as Label <DbClass >, instance.id)
1124
1139
}
1125
1140
1126
- extractClassCommon(c, id)
1141
+ extractClassModifiers(c, id)
1142
+ extractClassSupertypes(c, id)
1127
1143
1128
1144
return id
1129
1145
}
@@ -2012,14 +2028,6 @@ open class KotlinFileExtractor(
2012
2028
}
2013
2029
}
2014
2030
2015
- fun extractModifier (m : String ): Label <DbModifier > {
2016
- val modifierLabel = " @\" modifier;$m \" "
2017
- val id: Label <DbModifier > = tw.getLabelFor(modifierLabel, {
2018
- tw.writeModifiers(it, m)
2019
- })
2020
- return id
2021
- }
2022
-
2023
2031
fun extractTypeAccess (t : IrType , callable : Label <out DbCallable >, parent : Label <out DbExprparent >, idx : Int , elementForLocation : IrElement ) {
2024
2032
// TODO: elementForLocation allows us to give some sort of
2025
2033
// location, but a proper location for the type access will
0 commit comments