Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f43296a

Browse files
tamasvajkigfoo
authored andcommitted
Extract type access for enum value access
1 parent b5c8d29 commit f43296a

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2487,6 +2487,8 @@ open class KotlinFileExtractor(
24872487
if (receiver != null) {
24882488
extractExpressionExpr(receiver, callable, id, -1, exprParent.enclosingStmt)
24892489
}
2490+
2491+
// todo: do we need to extract a type access expression for static fields?
24902492
}
24912493
is IrGetEnumValue -> {
24922494
val exprParent = parent.expr(e, callable)
@@ -2511,6 +2513,8 @@ open class KotlinFileExtractor(
25112513

25122514
val vId = useEnumEntry(owner)
25132515
tw.writeVariableBinding(id, vId)
2516+
2517+
extractTypeAccessRecursive(e.type, locId, id, -1, callable, exprParent.enclosingStmt)
25142518
}
25152519
is IrSetValue,
25162520
is IrSetField -> {

java/ql/test/kotlin/library-tests/exprs_typeaccess/PrintAst.expected

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ A.kt:
6868
# 18| 0: [IntegerLiteral] 1
6969
# 19| 1: [LocalVariableDeclStmt] var ...;
7070
# 19| 1: [LocalVariableDeclExpr] e
71-
# 19| 0: [VarAccess] A
71+
# 19| 0: [VarAccess] Enu.A
72+
# 19| -1: [TypeAccess] Enu
7273
# 20| 2: [ReturnStmt] return ...
7374
# 20| 0: [IntegerLiteral] 5
7475
# 23| 11: [Class] Enu

0 commit comments

Comments
 (0)