mirror of
https://github.com/github/codeql.git
synced 2025-12-24 04:36:35 +01:00
Merge pull request #10675 from tamasvajk/kotlin-enum-constants
Kotlin: extract `isEnumConstant` relation
This commit is contained in:
@@ -1161,6 +1161,7 @@ open class KotlinFileExtractor(
|
||||
tw.writeFieldsKotlinType(id, type.kotlinResult.id)
|
||||
val locId = tw.getLocation(ee)
|
||||
tw.writeHasLocation(id, locId)
|
||||
tw.writeIsEnumConst(id)
|
||||
|
||||
if (extractTypeAccess) {
|
||||
val fieldDeclarationId = tw.getFreshIdLabel<DbFielddecl>()
|
||||
|
||||
@@ -1 +1,3 @@
|
||||
fun usesEnum(e: Enum<*>) = e.ordinal.toString() + e.name
|
||||
|
||||
enum class E { A, B, C }
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
enumConstants
|
||||
| enumUser.kt:3:16:3:17 | A |
|
||||
| enumUser.kt:3:19:3:20 | B |
|
||||
| enumUser.kt:3:22:3:22 | C |
|
||||
#select
|
||||
| addAll |
|
||||
| addRange |
|
||||
| allOf |
|
||||
|
||||
@@ -3,3 +3,5 @@ import java
|
||||
from Method m
|
||||
where m.getDeclaringType().getName().matches("Enum%")
|
||||
select m.getName()
|
||||
|
||||
query predicate enumConstants(EnumConstant ec) { ec.fromSource() }
|
||||
|
||||
Reference in New Issue
Block a user