Skip to content

Commit ec73f28

Browse files
authored
Merge pull request github#13479 from igfoo/igfoo/ENUM_ENTRIES
Kotlin: Handle IrSyntheticBodyKind.ENUM_ENTRIES
2 parents ea97c3e + ca5bc6f commit ec73f28

File tree

10 files changed

+5045
-5
lines changed

10 files changed

+5045
-5
lines changed

java/downgrades/ecfcf050952e54b1155fc89525db84af6ad34aaf/old.dbscheme

Lines changed: 1256 additions & 0 deletions
Large diffs are not rendered by default.

java/downgrades/ecfcf050952e54b1155fc89525db84af6ad34aaf/semmlecode.dbscheme

Lines changed: 1255 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
description: Remove ENUM_ENTRIES
2+
compatibility: full

java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1701,12 +1701,13 @@ open class KotlinFileExtractor(
17011701

17021702
private fun extractSyntheticBody(b: IrSyntheticBody, callable: Label<out DbCallable>) {
17031703
with("synthetic body", b) {
1704-
when (b.kind) {
1705-
IrSyntheticBodyKind.ENUM_VALUES -> tw.writeKtSyntheticBody(callable, 1)
1706-
IrSyntheticBodyKind.ENUM_VALUEOF -> tw.writeKtSyntheticBody(callable, 2)
1704+
val kind = b.kind
1705+
when {
1706+
kind == IrSyntheticBodyKind.ENUM_VALUES -> tw.writeKtSyntheticBody(callable, 1)
1707+
kind == IrSyntheticBodyKind.ENUM_VALUEOF -> tw.writeKtSyntheticBody(callable, 2)
1708+
kind == kind_ENUM_ENTRIES -> tw.writeKtSyntheticBody(callable, 3)
17071709
else -> {
1708-
// TODO: Support IrSyntheticBodyKind.ENUM_ENTRIES
1709-
logger.errorElement("Unhandled synthetic body kind " + b.kind.javaClass, b)
1710+
logger.errorElement("Unhandled synthetic body kind " + kind, b)
17101711
}
17111712
}
17121713
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package com.github.codeql.utils.versions
2+
3+
import org.jetbrains.kotlin.ir.expressions.IrSyntheticBodyKind
4+
5+
val kind_ENUM_ENTRIES: IrSyntheticBodyKind? = null
6+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package com.github.codeql.utils.versions
2+
3+
import org.jetbrains.kotlin.ir.expressions.IrSyntheticBodyKind
4+
5+
val kind_ENUM_ENTRIES: IrSyntheticBodyKind? = IrSyntheticBodyKind.ENUM_ENTRIES
6+

java/ql/lib/config/semmlecode.dbscheme

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,6 +1219,7 @@ ktSyntheticBody(
12191219
int kind: int ref
12201220
// 1: ENUM_VALUES
12211221
// 2: ENUM_VALUEOF
1222+
// 3: ENUM_ENTRIES
12221223
)
12231224

12241225
ktLocalFunction(

0 commit comments

Comments
 (0)