From cc4737887308f76a2c31eb9e0bd5042ba0f7bedb Mon Sep 17 00:00:00 2001 From: Karlatemp Date: Sat, 28 Nov 2020 13:02:32 +0800 Subject: [PATCH] Inline delegate functions --- .../src/util/AnsiMessageBuilder.kt | 59 ++++--------------- 1 file changed, 12 insertions(+), 47 deletions(-) diff --git a/backend/mirai-console/src/util/AnsiMessageBuilder.kt b/backend/mirai-console/src/util/AnsiMessageBuilder.kt index 892fc821e..d70be3501 100644 --- a/backend/mirai-console/src/util/AnsiMessageBuilder.kt +++ b/backend/mirai-console/src/util/AnsiMessageBuilder.kt @@ -131,53 +131,18 @@ public open class AnsiMessageBuilder internal constructor( } ///////////////////////////////////////////////////////////////////////////////// - override fun append(c: Char): AnsiMessageBuilder { - delegate.append(c); return this - } - - override fun append(csq: CharSequence?): AnsiMessageBuilder { - delegate.append(csq); return this - } - - override fun append(csq: CharSequence?, start: Int, end: Int): AnsiMessageBuilder { - delegate.append(csq, start, end); return this - } - - public fun append(any: Any?): AnsiMessageBuilder { - delegate.append(any); return this - } - - public fun append(value: String): AnsiMessageBuilder { - delegate.append(value); return this - } - - public fun append(value: String, start: Int, end: Int): AnsiMessageBuilder { - delegate.append(value, start, end); return this - } - - public fun append(value: Boolean): AnsiMessageBuilder { - delegate.append(value); return this - } - - public fun append(value: Float): AnsiMessageBuilder { - delegate.append(value); return this - } - - public fun append(value: Double): AnsiMessageBuilder { - delegate.append(value); return this - } - - public fun append(value: Int): AnsiMessageBuilder { - delegate.append(value); return this - } - - public fun append(value: Long): AnsiMessageBuilder { - delegate.append(value); return this - } - - public fun append(value: Short): AnsiMessageBuilder { - delegate.append(value); return this - } + override fun append(c: Char): AnsiMessageBuilder = apply { delegate.append(c) } + override fun append(csq: CharSequence?): AnsiMessageBuilder = apply { delegate.append(csq) } + override fun append(csq: CharSequence?, start: Int, end: Int): AnsiMessageBuilder = apply { delegate.append(csq, start, end) } + public fun append(any: Any?): AnsiMessageBuilder = apply { delegate.append(any) } + public fun append(value: String): AnsiMessageBuilder = apply { delegate.append(value) } + public fun append(value: String, start: Int, end: Int): AnsiMessageBuilder = apply { delegate.append(value, start, end) } + public fun append(value: Boolean): AnsiMessageBuilder = apply { delegate.append(value) } + public fun append(value: Float): AnsiMessageBuilder = apply { delegate.append(value) } + public fun append(value: Double): AnsiMessageBuilder = apply { delegate.append(value) } + public fun append(value: Int): AnsiMessageBuilder = apply { delegate.append(value) } + public fun append(value: Long): AnsiMessageBuilder = apply { delegate.append(value) } + public fun append(value: Short): AnsiMessageBuilder = apply { delegate.append(value) } ///////////////////////////////////////////////////////////////////////////////// }