Skip to content

Commit d0c8f33

Browse files
committed
Resolve some TODOs.
1 parent b16d296 commit d0c8f33

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

SKIE/acceptance-tests

SKIE/compiler/kotlin-plugin/src/kgp_common/kotlin/co/touchlab/skie/sir/SkieNamespaceProvider.kt

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class SkieNamespaceProvider(
8888

8989
private val KirModule.namespaceModuleName: String
9090
get() {
91-
val canUseShortName = !this.shortNameCollides && shortNamespaceModuleName != sirProvider.sirBuiltins.Skie.module.name.toValidNamespaceIdentifier()
91+
val canUseShortName = !this.shortNameCollides && shortNamespaceModuleName != sirProvider.sirBuiltins.Skie.module.name.toValidSwiftIdentifier()
9292

9393
return if (canUseShortName) this.shortNamespaceModuleName else this.fullNamespaceModuleName
9494
}
@@ -103,15 +103,8 @@ class SkieNamespaceProvider(
103103
private val KirModule.shortNameCollides: Boolean
104104
get() = this in modulesWithShortNameCollision
105105

106-
// WIP Remove after renaming all classes to avoid collision with ModuleName
107-
private fun String.toValidNamespaceIdentifier(): String {
108-
val defaultName = this.toValidSwiftIdentifier()
109-
110-
return if (defaultName == sirProvider.sirBuiltins.Skie.module.name) defaultName + "_" else defaultName
111-
}
112-
113106
private val KirClass.skieNamespaceSimpleName: String
114-
get() = this.classDescriptorOrNull?.name?.identifier?.toValidNamespaceIdentifier() ?: this.name.swiftName
107+
get() = this.classDescriptorOrNull?.name?.identifier?.toValidSwiftIdentifier() ?: this.name.swiftName
115108

116109
@Suppress("RecursivePropertyAccessor")
117110
private val KirClass.skieFileName: String
@@ -121,12 +114,12 @@ class SkieNamespaceProvider(
121114
get() = this.name
122115
.substringAfter(":")
123116
.changeNamingConventionToPascalCase()
124-
.toValidNamespaceIdentifier()
117+
.toValidSwiftIdentifier()
125118

126119
private val KirModule.fullNamespaceModuleName: String
127120
get() = this.name
128121
.replace(":", "__")
129-
.toValidNamespaceIdentifier()
122+
.toValidSwiftIdentifier()
130123
}
131124

132125
private fun String.changeNamingConventionToPascalCase(): String =

0 commit comments

Comments
 (0)