Fix deprecated Kotlin constructs and remove unused code in Android plugins
This commit is contained in:
+1
-1
@@ -35,7 +35,7 @@ open class Context(val buffer: StringBuffer = StringBuffer(), private var indent
|
||||
indentDepth--
|
||||
if (indentDepth < 0)
|
||||
throw InvalidIndent(indentDepth)
|
||||
currentIndent = currentIndent.substring(0, currentIndent.length - indentUnit.length)
|
||||
currentIndent = currentIndent.substring(0, currentIndent.length() - indentUnit.length())
|
||||
}
|
||||
|
||||
public open fun write(what: String) {
|
||||
|
||||
-22
@@ -26,28 +26,6 @@ class KotlinStringWriter : KotlinWriter {
|
||||
private val imports = ctx.fork()
|
||||
private val body = ctx.fork()
|
||||
|
||||
fun writeFunction(name: String,
|
||||
args: Collection<String>?,
|
||||
retType: String,
|
||||
statements: Collection<String>) {
|
||||
val returnTerm = if (retType == "" || retType == "Unit") "" else ": $retType"
|
||||
val argStr = if (args != null) args.join(", ") else ""
|
||||
body.writeln("fun $name($argStr)$returnTerm {")
|
||||
body.incIndent()
|
||||
for (stmt in statements)
|
||||
body.writeln(stmt)
|
||||
body.decIndent()
|
||||
body.writeln("}")
|
||||
}
|
||||
|
||||
fun writeExtensionFunction(receiver: String,
|
||||
name: String,
|
||||
args: Collection<String>?,
|
||||
retType: String,
|
||||
body: Collection<String>) {
|
||||
writeFunction("$receiver.$name", args, retType, body)
|
||||
}
|
||||
|
||||
fun writeImmutableProperty(name: String,
|
||||
retType: String,
|
||||
getterBody: Collection<String>) {
|
||||
|
||||
Reference in New Issue
Block a user