Apply infix modifier on functions from stdlib where appropriate.

This commit is contained in:
Ilya Gorbunov
2015-11-14 18:34:06 +03:00
parent 794819cea2
commit a426c7879f
9 changed files with 75 additions and 69 deletions
+1 -1
View File
@@ -528,4 +528,4 @@ fun merge(i1: InterfaceDefinition, i2: InterfaceDefinition): InterfaceDefinition
)
}
fun <T> List<T>.merge(other: List<T>) = (this + other).distinct().toList()
infix fun <T> List<T>.merge(other: List<T>) = (this + other).distinct()
@@ -59,11 +59,9 @@ private fun String.replaceWrongConstants(type: Type) = when {
private fun String.replaceKeywords() = if (this in keywords) this + "_" else this
private fun Appendable.renderArgumentsDeclaration(args: List<GenerateAttribute>, omitDefaults: Boolean = false) =
args.map {
StringBuilder {
renderAttributeDeclaration(it, it.override, false, omitDefaults)
}
}.joinTo(this, ", ", "(", ")")
args.joinTo(this, ", ", "(", ")") {
StringBuilder().apply { renderAttributeDeclaration(it, it.override, false, omitDefaults) }
}
private fun renderCall(call: GenerateFunctionCall) = "${call.name.replaceKeywords()}(${call.arguments.joinToString(", ") { it.replaceKeywords() }})"