add distinction between functions and methods in SIR #KT-65046 fixed

Merge-request: KT-MR-14667
Merged-by: Artem Olkov <artem.olkov@jetbrains.com>
This commit is contained in:
Artem Olkov
2024-02-29 12:52:10 +00:00
committed by Space Team
parent 12552e4e04
commit e6705e9db2
23 changed files with 138 additions and 63 deletions
@@ -76,13 +76,14 @@ object SwiftIrTree : AbstractSwiftIrTreeBuilder() {
val callable by sealedElement {
parent(declaration)
+field("kind", callableKind)
}
val function by element {
customParentInVisitor = callable
parent(callable)
+field("isStatic", boolean) // todo: KT-65046 Method|function distinction in SIR
+field("name", string)
+listField("parameters", parameterType)
+field("returnType", typeType)
@@ -118,8 +119,6 @@ object SwiftIrTree : AbstractSwiftIrTreeBuilder() {
+field("getter", getter)
+field("setter", setter, nullable = true)
+field("isStatic", boolean) // todo: KT-65046 Method|function distinction in SIR
}
val import by element {
@@ -15,6 +15,7 @@ val parameterType = type(BASE_PACKAGE, "SirParameter", TypeKind.Class)
val typeType = type(BASE_PACKAGE, "SirType", TypeKind.Class)
val enumCaseType = type(BASE_PACKAGE, "SirEnumCase", TypeKind.Class)
val functionBodyType = type(BASE_PACKAGE, "SirFunctionBody", TypeKind.Class)
val callableKind = type(BASE_PACKAGE, "SirCallableKind", TypeKind.Class)
private const val VISITORS_PACKAGE = "$BASE_PACKAGE.visitors"