Remove KotlinSirOrigin hierarchy in favour of direct AA usage #KT-65335 Fixed

Merge-request: KT-MR-14229
Merged-by: Artem Olkov <artem.olkov@jetbrains.com>
This commit is contained in:
Artem Olkov
2024-02-09 18:34:52 +00:00
committed by Space Team
parent c2e0c8b2e9
commit b6c805bbb6
94 changed files with 548 additions and 1912 deletions
@@ -128,12 +128,6 @@ public class SirAsSwiftSourcesPrinter(private val printer: SmartPrinter) : SirVi
println("}")
}
// we do not write foreign nodes
override fun visitForeignFunction(function: SirForeignFunction) {}
override fun visitForeignVariable(variable: SirForeignVariable) {}
override fun visitElement(element: SirElement): Unit = with(printer) {
println("/* ERROR: unsupported element type: " + element.javaClass.simpleName + " */")
}
@@ -6,7 +6,6 @@
package org.jetbrains.kotlin.sir.printer
import org.jetbrains.kotlin.sir.*
import org.jetbrains.kotlin.sir.builder.buildForeignFunction
import org.jetbrains.kotlin.sir.builder.buildFunction
import org.jetbrains.kotlin.sir.builder.buildModule
import org.jetbrains.kotlin.sir.util.SirSwiftModule
@@ -17,18 +16,6 @@ import org.junit.jupiter.api.Test
import java.io.File
class SirAsSwiftSourcesPrinterTests {
@Test
fun `should ignore foreign elements`() {
val module = buildModule {
name = "Test"
declarations.add(foreignFunction())
}
runTest(
module,
"testData/empty"
)
}
@Test
fun `should print simple function`() {
@@ -146,7 +133,6 @@ class SirAsSwiftSourcesPrinterTests {
fun `should all types as parameter be handled`() {
val module = buildModule {
name = "Test"
declarations.add(foreignFunction())
declarations.add(
buildFunction {
@@ -295,9 +281,4 @@ class SirAsSwiftSourcesPrinterTests {
val actualSwiftSrc = SirAsSwiftSourcesPrinter().print(module)
JUnit5Assertions.assertEqualsToFile(expectedSwiftSrc, actualSwiftSrc)
}
private fun foreignFunction(): SirForeignFunction = buildForeignFunction {
origin = SirOrigin.Unknown
visibility = SirVisibility.PUBLIC
}
}