-
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #887 from simple-robot/optimize-messages-structure
优化、调整MessagesBuilder实现结构
- Loading branch information
Showing
4 changed files
with
160 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
* Project https://github.com/simple-robot/simpler-robot | ||
* Email [email protected] | ||
* | ||
* This file is part of the Simple Robot Library. | ||
* This file is part of the Simple Robot Library (Alias: simple-robot, simbot, etc.). | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
|
@@ -30,7 +30,6 @@ import kotlin.jvm.JvmMultifileClass | |
import kotlin.jvm.JvmName | ||
|
||
|
||
|
||
/** | ||
* Builds a list of Messages using the provided container and block. | ||
* | ||
|
@@ -48,29 +47,81 @@ public inline fun buildMessages( | |
/** | ||
* 使用 `+=` operator 添加 [element]。 | ||
* | ||
* @see MessagesBuilder.add | ||
* @since 4.4.0 | ||
* @see MessagesAddable.add | ||
*/ | ||
@MessagesBuilderDsl | ||
public operator fun MessagesBuilder.plusAssign(element: Message.Element) { | ||
public operator fun MessagesAddable<*>.plusAssign(element: Message.Element) { | ||
add(element) | ||
} | ||
|
||
/** | ||
* 使用 `+=` operator 添加 [text]。 | ||
* | ||
* @see MessagesBuilder.add | ||
* @since 4.4.0 | ||
* | ||
* @see MessagesAddable.add | ||
*/ | ||
@MessagesBuilderDsl | ||
public operator fun MessagesBuilder.plusAssign(text: String) { | ||
public operator fun MessagesAddable<*>.plusAssign(text: String) { | ||
add(text) | ||
} | ||
|
||
/** | ||
* 使用 `+=` operator 添加 [messages]。 | ||
* | ||
* @see MessagesBuilder.addAll | ||
* @since 4.4.0 | ||
* @see MessagesAddable.addAll | ||
*/ | ||
@MessagesBuilderDsl | ||
public operator fun MessagesBuilder.plusAssign(messages: Iterable<Message.Element>) { | ||
public operator fun MessagesAddable<*>.plusAssign(messages: Iterable<Message.Element>) { | ||
addAll(messages) | ||
} | ||
|
||
/** | ||
* 使用 `+=` operator 添加 [element]。 | ||
* | ||
* @suppress deprecated | ||
* @see MessagesBuilder.add | ||
*/ | ||
@Deprecated( | ||
"使用receiver类型为MessagesAddable的重载", | ||
ReplaceWith("plusAssign(messages)") | ||
) | ||
@MessagesBuilderDsl | ||
@JvmName("plusAssign") // binary compatible | ||
public fun MessagesBuilder.plusAssign0(element: Message.Element) { | ||
plusAssign(element) | ||
} | ||
|
||
/** | ||
* 使用 `+=` operator 添加 [text]。 | ||
* | ||
* @suppress deprecated | ||
* @see MessagesBuilder.add | ||
*/ | ||
@Deprecated( | ||
"使用receiver类型为MessagesAddable的重载", | ||
ReplaceWith("plusAssign(messages)") | ||
) | ||
@MessagesBuilderDsl | ||
@JvmName("plusAssign") // binary compatible | ||
public fun MessagesBuilder.plusAssign0(text: String) { | ||
plusAssign(text) | ||
} | ||
|
||
/** | ||
* 使用 `+=` operator 添加 [messages]。 | ||
* | ||
* @suppress deprecated | ||
* @see MessagesBuilder.addAll | ||
*/ | ||
@Deprecated( | ||
"使用receiver类型为MessagesAddable的重载", | ||
ReplaceWith("plusAssign(messages)") | ||
) | ||
@MessagesBuilderDsl | ||
@JvmName("plusAssign") // binary compatible | ||
public fun MessagesBuilder.plusAssign0(messages: Iterable<Message.Element>) { | ||
plusAssign(messages) | ||
} |
Submodule website
updated
4 files
+ − | Writerside/images/FAQ-包引用异常.png | |
+1 −0 | Writerside/s4.tree | |
+43 −0 | Writerside/topics/FAQ.md | |
+1 −1 | Writerside/v.list |