Skip to content

Commit 4ca8d08

Browse files
authored
Support EnumValueType (#321)
- Use AA branch `neo/2025-05-30b`
1 parent 126a4e8 commit 4ca8d08

File tree

4 files changed

+30
-1
lines changed

4 files changed

+30
-1
lines changed

.github/workflows/build-and-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
DEST_DIR="arkanalyzer"
6565
MAX_RETRIES=10
6666
RETRY_DELAY=3 # Delay between retries in seconds
67-
BRANCH="neo/2025-04-14"
67+
BRANCH="neo/2025-05-30b"
6868
6969
for ((i=1; i<=MAX_RETRIES; i++)); do
7070
git clone --depth=1 --branch $BRANCH $REPO_URL $DEST_DIR && break

jacodb-ets/src/main/kotlin/org/jacodb/ets/dto/Convert.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ import org.jacodb.ets.model.EtsDecorator
4545
import org.jacodb.ets.model.EtsDeleteExpr
4646
import org.jacodb.ets.model.EtsDivExpr
4747
import org.jacodb.ets.model.EtsEntity
48+
import org.jacodb.ets.model.EtsEnumValueType
4849
import org.jacodb.ets.model.EtsEqExpr
4950
import org.jacodb.ets.model.EtsExpExpr
5051
import org.jacodb.ets.model.EtsExpr
@@ -492,6 +493,11 @@ fun TypeDto.toEtsType(): EtsType = when (this) {
492493

493494
is ClassTypeDto -> toEtsClassType()
494495

496+
is EnumValueTypeDto -> EtsEnumValueType(
497+
signature = signature.toEtsFieldSignature(),
498+
constant = constant?.toEtsConstant(),
499+
)
500+
495501
is FunctionTypeDto -> EtsFunctionType(
496502
signature = signature.toEtsMethodSignature(),
497503
typeParameters = typeParameters.map { it.toEtsType() },

jacodb-ets/src/main/kotlin/org/jacodb/ets/dto/Types.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,13 @@ data class AliasTypeDto(
6161
val signature: LocalSignatureDto,
6262
) : TypeDto
6363

64+
@Serializable
65+
@SerialName("EnumValueType")
66+
data class EnumValueTypeDto(
67+
val signature: FieldSignatureDto,
68+
val constant: ConstantDto? = null,
69+
): TypeDto
70+
6471
@Serializable
6572
@SerialName("VoidType")
6673
data object VoidTypeDto : TypeDto

jacodb-ets/src/main/kotlin/org/jacodb/ets/model/Type.kt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ interface EtsType : TypeName, CommonType {
3030
fun visit(type: EtsIntersectionType): R
3131
fun visit(type: EtsGenericType): R
3232
fun visit(type: EtsAliasType): R
33+
fun visit(type: EtsEnumValueType): R
3334

3435
// Primitive
3536
fun visit(type: EtsBooleanType): R
@@ -62,6 +63,7 @@ interface EtsType : TypeName, CommonType {
6263
override fun visit(type: EtsIntersectionType): R = defaultVisit(type)
6364
override fun visit(type: EtsGenericType): R = defaultVisit(type)
6465
override fun visit(type: EtsAliasType): R = defaultVisit(type)
66+
override fun visit(type: EtsEnumValueType): R = defaultVisit(type)
6567

6668
override fun visit(type: EtsBooleanType): R = defaultVisit(type)
6769
override fun visit(type: EtsNumberType): R = defaultVisit(type)
@@ -371,3 +373,17 @@ data class EtsFunctionType(
371373
return visitor.visit(this)
372374
}
373375
}
376+
377+
data class EtsEnumValueType(
378+
val signature: EtsFieldSignature,
379+
val constant: EtsConstant? = null,
380+
): EtsType {
381+
override val typeName: String
382+
get() = signature.name
383+
384+
override fun toString(): String = typeName
385+
386+
override fun <R> accept(visitor: EtsType.Visitor<R>): R {
387+
return visitor.visit(this)
388+
}
389+
}

0 commit comments

Comments
 (0)