mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
Kotlin: Add modifiers to object INSTANCEs
This commit is contained in:
@@ -889,6 +889,9 @@ open class KotlinFileExtractor(
|
||||
val type = useSimpleTypeClass(c, emptyList(), false)
|
||||
tw.writeFields(instance.id, instance.name, type.javaResult.id, type.kotlinResult.id, id, instance.id)
|
||||
tw.writeHasLocation(instance.id, locId)
|
||||
tw.writeHasModifier(instance.id, extractModifier("public"))
|
||||
tw.writeHasModifier(instance.id, extractModifier("static"))
|
||||
tw.writeHasModifier(instance.id, extractModifier("final"))
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
tw.writeClass_object(id as Label<DbClass>, instance.id)
|
||||
}
|
||||
@@ -1675,6 +1678,14 @@ open class KotlinFileExtractor(
|
||||
}
|
||||
}
|
||||
|
||||
fun extractModifier(m: String): Label<DbModifier> {
|
||||
val modifierLabel = "@\"modifier;$m\""
|
||||
val id: Label<DbModifier> = tw.getLabelFor(modifierLabel, {
|
||||
tw.writeModifiers(it, m)
|
||||
})
|
||||
return id
|
||||
}
|
||||
|
||||
fun extractTypeAccess(t: IrType, parent: Label<out DbExprparent>, idx: Int, elementForLocation: IrElement) {
|
||||
// TODO: elementForLocation allows us to give some sort of
|
||||
// location, but a proper location for the type access will
|
||||
|
||||
@@ -1 +1 @@
|
||||
| objects.kt:2:1:4:1 | MyObject | objects.kt:2:1:4:1 | INSTANCE |
|
||||
| objects.kt:2:1:4:1 | MyObject | objects.kt:2:1:4:1 | INSTANCE | final,public,static |
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import java
|
||||
|
||||
from ClassObject co
|
||||
from ClassObject co, Field f
|
||||
where co.fromSource()
|
||||
select co, co.getInstance()
|
||||
and f = co.getInstance()
|
||||
select co, f, concat(f.getAModifier().toString(), ",")
|
||||
|
||||
Reference in New Issue
Block a user