FIR: annotate 'replaceSource' with '@FirImplementationDetail'
This commit is contained in:
+3
@@ -89,6 +89,9 @@ fun SmartPrinter.printElement(element: Element) {
|
||||
|
||||
fun Field.replaceDeclaration(override: Boolean, overridenType: Importable? = null, forceNullable: Boolean = false) {
|
||||
println()
|
||||
if (name == "source") {
|
||||
println("@FirImplementationDetail")
|
||||
}
|
||||
abstract()
|
||||
if (override) print("override ")
|
||||
println(replaceFunctionDeclaration(overridenType, forceNullable))
|
||||
|
||||
+3
@@ -313,6 +313,9 @@ fun SmartPrinter.printImplementation(implementation: Implementation) {
|
||||
body: () -> Unit,
|
||||
) {
|
||||
println()
|
||||
if (field.name == "source") {
|
||||
println("@FirImplementationDetail")
|
||||
}
|
||||
abstract()
|
||||
print("override ${field.replaceFunctionDeclaration(overridenType, forceNullable)}")
|
||||
if (isInterface || isAbstract) {
|
||||
|
||||
+5
-2
@@ -10,7 +10,6 @@ import org.jetbrains.kotlin.fir.tree.generator.context.AbstractFirTreeBuilder
|
||||
import org.jetbrains.kotlin.fir.tree.generator.firImplementationDetailType
|
||||
import org.jetbrains.kotlin.fir.tree.generator.model.*
|
||||
import org.jetbrains.kotlin.fir.tree.generator.pureAbstractElementType
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.runIf
|
||||
import java.io.File
|
||||
|
||||
class GeneratedFile(val file: File, val newText: String)
|
||||
@@ -71,7 +70,11 @@ private fun Element.collectImportsInternal(base: List<String>, kind: ImportKind)
|
||||
allFields.flatMap { it.overridenTypes.mapNotNull { it.fullQualifiedName } } +
|
||||
allFields.flatMap { it.arguments.mapNotNull { it.fullQualifiedName } } +
|
||||
typeArguments.flatMap { it.upperBounds.mapNotNull { it.fullQualifiedName } }
|
||||
return fqns.filterRedundantImports(packageName, kind)
|
||||
val result = fqns.filterRedundantImports(packageName, kind)
|
||||
if (allFields.any { it.name == "source" && it.withReplace }) {
|
||||
return (result + "org.jetbrains.kotlin.fir.FirImplementationDetail").distinct()
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
private fun List<String>.filterRedundantImports(
|
||||
|
||||
Reference in New Issue
Block a user