Merge pull request #10675 from tamasvajk/kotlin-enum-constants

Kotlin: extract `isEnumConstant` relation
This commit is contained in:
Tamás Vajk
2022-10-04 21:53:22 +02:00
committed by GitHub
4 changed files with 10 additions and 0 deletions

View File

@@ -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>()

View File

@@ -1 +1,3 @@
fun usesEnum(e: Enum<*>) = e.ordinal.toString() + e.name
enum class E { A, B, C }

View File

@@ -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 |

View File

@@ -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() }