Introduce deprecated helpers to ease migration

This commit is contained in:
Ilya Gorbunov
2017-11-03 20:55:10 +03:00
parent 9f57a2c0d5
commit db049c0ab6
@@ -59,6 +59,8 @@ class MemberBuilder(
var deprecate: Deprecation? = null; private set
var since: String? = null; private set
var platformName: String? = null; private set
@Deprecated("Use platforms when building template")
var jvmOnly: Boolean = false
var visibility: String? = null; private set
var external: Boolean = false; private set
@@ -102,6 +104,8 @@ class MemberBuilder(
signature = value
}
fun returns(type: String) { returns = type }
@Deprecated("Use specialFor", ReplaceWith("specialFor(*fs) { returns(run(valueBuilder)) }"))
fun returns(vararg fs: Family, valueBuilder: () -> String) = specialFor(*fs) { returns(run(valueBuilder)) }
fun typeParam(typeParameterName: String) {
typeParams += typeParameterName
@@ -119,6 +123,9 @@ class MemberBuilder(
doc = valueBuilder(DocExtensions)
}
@Deprecated("Use specialFor", ReplaceWith("specialFor(*fs) { doc(valueBuilder) }"))
fun doc(vararg fs: Family, valueBuilder: DocExtensions.() -> String) = specialFor(*fs) { doc(valueBuilder) }
fun body(valueBuilder: () -> String) {
body = valueBuilder()
}
@@ -323,6 +330,11 @@ class MemberBuilder(
builder.append("@kotlin.internal.InlineOnly").append('\n')
}
if (jvmOnly) {
builder.append("@kotlin.jvm.JvmVersion").append('\n')
}
listOfNotNull(
visibility ?: "public",
"expect".takeIf { headerOnly },