Sort out warnings related to inline and library functions in stdlib-js

This commit is contained in:
Ilya Gorbunov
2017-04-13 22:08:33 +03:00
parent 6ae19e03d5
commit 37c3d8f204
11 changed files with 54 additions and 9 deletions
@@ -58,7 +58,10 @@ fun arrays(): List<GenericFunction> {
returns("Boolean")
body(Platform.JVM) { "return java.util.Arrays.equals(this, other)" }
annotations(Platform.JS, """@library("arrayEquals")""")
annotations(Platform.JS, """
@library("arrayEquals")
@Suppress("UNUSED_PARAMETER")
""")
body(Platform.JS) { "definedExternally" }
}
@@ -79,7 +82,10 @@ fun arrays(): List<GenericFunction> {
}
returns("Boolean")
body(Platform.JVM) { "return java.util.Arrays.deepEquals(this, other)" }
annotations(Platform.JS, """@library("arrayDeepEquals")""")
annotations(Platform.JS, """
@library("arrayDeepEquals")
@Suppress("UNUSED_PARAMETER")
""")
body(Platform.JS) { "definedExternally" }
}
@@ -24,7 +24,7 @@ fun specialJS(): List<GenericFunction> {
templates add f("sort(noinline comparison: (a: T, b: T) -> Int)") {
only(ArraysOfObjects, ArraysOfPrimitives)
exclude(PrimitiveType.Boolean)
inline(true)
inline(Inline.Only)
returns("Unit")
doc { "Sorts the array in-place according to the order specified by the given [comparison] function." }
body { "asDynamic().sort(comparison)" }
@@ -497,7 +497,7 @@ object CommonArrays {
body(Platform.JS) { objectLiteralImpl }
}
else {
inline(Platform.JS, Inline.Yes, ArraysOfPrimitives)
inline(Platform.JS, Inline.Only, ArraysOfPrimitives)
body(Platform.JS) { "return this.unsafeCast<Array<T>>().asList()" }
}
}
@@ -483,7 +483,7 @@ class GenericFunction(val signature: String, val keyword: String = "fun") {
builder.append("@SinceKotlin(\"$since\")\n")
}
annotations[platform, f]?.let { builder.append(it).append('\n') }
annotations[platform, f]?.let { builder.append(it.trimIndent()).append('\n') }
if (inline[platform, f] == Inline.Only) {
builder.append("@kotlin.internal.InlineOnly").append('\n')