[tree generator] Allow adding kDocs to implementation classes
This commit is contained in:
committed by
Space Team
parent
cd20f31810
commit
c379fd7fa1
+2
@@ -48,6 +48,8 @@ abstract class AbstractImplementation<Implementation, Element, Field>(
|
||||
*/
|
||||
val additionalImports = mutableListOf<Importable>()
|
||||
|
||||
var kDoc: String? = null
|
||||
|
||||
init {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
element.implementations += this as Implementation
|
||||
|
||||
+2
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.generators.tree
|
||||
import org.jetbrains.kotlin.descriptors.Modality
|
||||
import org.jetbrains.kotlin.generators.tree.printer.braces
|
||||
import org.jetbrains.kotlin.generators.tree.printer.printBlock
|
||||
import org.jetbrains.kotlin.generators.tree.printer.printKDoc
|
||||
import org.jetbrains.kotlin.generators.tree.printer.typeParameters
|
||||
import org.jetbrains.kotlin.utils.SmartPrinter
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.ifNotEmpty
|
||||
@@ -37,6 +38,7 @@ abstract class AbstractImplementationPrinter<Implementation, Element, Implementa
|
||||
fun printImplementation(implementation: Implementation) {
|
||||
addAllImports(implementation.additionalImports)
|
||||
printer.run {
|
||||
printKDoc(implementation.kDoc)
|
||||
buildSet {
|
||||
if (implementation.requiresOptIn) {
|
||||
add(implementationOptInAnnotation)
|
||||
|
||||
+4
@@ -142,6 +142,10 @@ abstract class AbstractImplementationConfigurator<Implementation, Element, Imple
|
||||
implementation.isPublic = true
|
||||
}
|
||||
|
||||
fun kDoc(kDoc: String) {
|
||||
implementation.kDoc = kDoc
|
||||
}
|
||||
|
||||
private fun getField(name: String): ImplementationField {
|
||||
return implementation.getField(name)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user