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

Skip to content

Commit b5c8d29

Browse files
tamasvajkigfoo
authored andcommitted
Extract enum field declarations
1 parent d6cbcdc commit b5c8d29

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,15 @@ open class KotlinFileExtractor(
830830
tw.writeFieldsKotlinType(id, type.kotlinResult.id)
831831
val locId = tw.getLocation(ee)
832832
tw.writeHasLocation(id, locId)
833+
834+
if (!isExternalDeclaration(ee)) {
835+
val fieldDeclarationId = tw.getFreshIdLabel<DbFielddecl>()
836+
tw.writeFielddecls(fieldDeclarationId, parentId)
837+
tw.writeFieldDeclaredIn(id, fieldDeclarationId, 0)
838+
tw.writeHasLocation(fieldDeclarationId, locId)
839+
840+
extractTypeAccess(type, locId, fieldDeclarationId, 0)
841+
}
833842
}
834843
}
835844
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ A.kt:
8787
# 23| -3: [TypeAccess] Unit
8888
# 23| 0: [TypeAccess] Enu
8989
# 23| 1: [BlockStmt] { ... }
90+
# 24| 4: [FieldDeclaration] Enu A;
91+
# 24| -1: [TypeAccess] Enu
92+
# 24| 5: [FieldDeclaration] Enu B;
93+
# 24| -1: [TypeAccess] Enu
94+
# 24| 6: [FieldDeclaration] Enu C;
95+
# 24| -1: [TypeAccess] Enu
9096
B.java:
9197
# 0| [CompilationUnit] B
9298
# 1| 1: [Class] B

0 commit comments

Comments
 (0)