From ea94c852e7a577ca4fcae93756d528cbd074d8b9 Mon Sep 17 00:00:00 2001 From: theEvilReaper Date: Mon, 15 Jan 2024 14:42:08 +0100 Subject: [PATCH] Add usage of the DocumentationAppender --- .../dartpoet/code/writer/FunctionWriter.kt | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/main/kotlin/net/theevilreaper/dartpoet/code/writer/FunctionWriter.kt b/src/main/kotlin/net/theevilreaper/dartpoet/code/writer/FunctionWriter.kt index 60522a99..ad7b6ab0 100644 --- a/src/main/kotlin/net/theevilreaper/dartpoet/code/writer/FunctionWriter.kt +++ b/src/main/kotlin/net/theevilreaper/dartpoet/code/writer/FunctionWriter.kt @@ -1,9 +1,8 @@ package net.theevilreaper.dartpoet.code.writer import net.theevilreaper.dartpoet.DartModifier.* -import net.theevilreaper.dartpoet.code.CodeBlock -import net.theevilreaper.dartpoet.code.CodeWriter -import net.theevilreaper.dartpoet.code.Writeable +import net.theevilreaper.dartpoet.code.* +import net.theevilreaper.dartpoet.code.DocumentationAppender import net.theevilreaper.dartpoet.code.emitParameters import net.theevilreaper.dartpoet.function.FunctionSpec import net.theevilreaper.dartpoet.parameter.ParameterSpec @@ -14,12 +13,10 @@ import net.theevilreaper.dartpoet.util.SEMICOLON import net.theevilreaper.dartpoet.util.SPACE import net.theevilreaper.dartpoet.util.toImmutableSet -internal class FunctionWriter : Writeable { +internal class FunctionWriter : Writeable, DocumentationAppender { override fun write(spec: FunctionSpec, writer: CodeWriter) { - if (spec.hasDocs) { - spec.docs.forEach { writer.emitDoc(it) } - } + emitDocumentation(spec.docs, writer) if (spec.annotation.isNotEmpty()) { spec.annotation.forEach { it.write(writer) }