JS: get rid of external extension functions and properties in stdlib
This commit is contained in:
@@ -19,9 +19,9 @@ package kotlin.text
|
||||
// actually \s is enough to match all whitespace, but \xA0 added because of different regexp behavior of Rhino used in Selenium tests
|
||||
public fun Char.isWhitespace(): Boolean = toString().matches("[\\s\\xA0]")
|
||||
|
||||
public external fun Char.toLowerCase(): Char = noImpl
|
||||
public inline fun Char.toLowerCase(): Char = asDynamic().toLowerCase()
|
||||
|
||||
public external fun Char.toUpperCase(): Char = noImpl
|
||||
public inline fun Char.toUpperCase(): Char = asDynamic().toUpperCase()
|
||||
|
||||
/**
|
||||
* Returns `true` if this character is a Unicode high-surrogate code unit (also known as leading-surrogate code unit).
|
||||
|
||||
@@ -7,7 +7,7 @@ public external fun eval(expr: String): dynamic = noImpl
|
||||
|
||||
public external val undefined: Nothing? = noImpl
|
||||
|
||||
external operator fun <K, V> MutableMap<K, V>.set(key: K, value: V): V? = noImpl
|
||||
inline operator fun <K, V> MutableMap<K, V>.set(key: K, value: V): V? = asDynamic().set(key, value)
|
||||
|
||||
@library
|
||||
public fun println() {}
|
||||
|
||||
@@ -844,57 +844,57 @@ public fun <T> Array<out T>.contentDeepHashCode(): Int {
|
||||
/**
|
||||
* Sorts the array in-place according to the order specified by the given [comparison] function.
|
||||
*/
|
||||
public external fun <T> Array<out T>.sort(comparison: (T, T) -> Int): Unit {
|
||||
noImpl
|
||||
public inline fun <T> Array<out T>.sort(noinline comparison: (T, T) -> Int): Unit {
|
||||
asDynamic().sort(comparison)
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts the array in-place according to the order specified by the given [comparison] function.
|
||||
*/
|
||||
public external fun ByteArray.sort(comparison: (Byte, Byte) -> Int): Unit {
|
||||
noImpl
|
||||
public inline fun ByteArray.sort(noinline comparison: (Byte, Byte) -> Int): Unit {
|
||||
asDynamic().sort(comparison)
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts the array in-place according to the order specified by the given [comparison] function.
|
||||
*/
|
||||
public external fun ShortArray.sort(comparison: (Short, Short) -> Int): Unit {
|
||||
noImpl
|
||||
public inline fun ShortArray.sort(noinline comparison: (Short, Short) -> Int): Unit {
|
||||
asDynamic().sort(comparison)
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts the array in-place according to the order specified by the given [comparison] function.
|
||||
*/
|
||||
public external fun IntArray.sort(comparison: (Int, Int) -> Int): Unit {
|
||||
noImpl
|
||||
public inline fun IntArray.sort(noinline comparison: (Int, Int) -> Int): Unit {
|
||||
asDynamic().sort(comparison)
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts the array in-place according to the order specified by the given [comparison] function.
|
||||
*/
|
||||
public external fun LongArray.sort(comparison: (Long, Long) -> Int): Unit {
|
||||
noImpl
|
||||
public inline fun LongArray.sort(noinline comparison: (Long, Long) -> Int): Unit {
|
||||
asDynamic().sort(comparison)
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts the array in-place according to the order specified by the given [comparison] function.
|
||||
*/
|
||||
public external fun FloatArray.sort(comparison: (Float, Float) -> Int): Unit {
|
||||
noImpl
|
||||
public inline fun FloatArray.sort(noinline comparison: (Float, Float) -> Int): Unit {
|
||||
asDynamic().sort(comparison)
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts the array in-place according to the order specified by the given [comparison] function.
|
||||
*/
|
||||
public external fun DoubleArray.sort(comparison: (Double, Double) -> Int): Unit {
|
||||
noImpl
|
||||
public inline fun DoubleArray.sort(noinline comparison: (Double, Double) -> Int): Unit {
|
||||
asDynamic().sort(comparison)
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts the array in-place according to the order specified by the given [comparison] function.
|
||||
*/
|
||||
public external fun CharArray.sort(comparison: (Char, Char) -> Int): Unit {
|
||||
noImpl
|
||||
public inline fun CharArray.sort(noinline comparison: (Char, Char) -> Int): Unit {
|
||||
asDynamic().sort(comparison)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,21 +2,17 @@ package kotlin.text
|
||||
|
||||
import kotlin.text.js.RegExp
|
||||
|
||||
public external fun String.toUpperCase(): String = noImpl
|
||||
public inline fun String.toUpperCase(): String = asDynamic().toUpperCase()
|
||||
|
||||
public external fun String.toLowerCase(): String = noImpl
|
||||
public inline fun String.toLowerCase(): String = asDynamic().toLowerCase()
|
||||
|
||||
@JsName("indexOf")
|
||||
internal external fun String.nativeIndexOf(str: String, fromIndex: Int): Int = noImpl
|
||||
internal inline fun String.nativeIndexOf(str: String, fromIndex: Int): Int = asDynamic().indexOf(str, fromIndex)
|
||||
|
||||
@JsName("lastIndexOf")
|
||||
internal external fun String.nativeLastIndexOf(str: String, fromIndex: Int): Int = noImpl
|
||||
internal inline fun String.nativeLastIndexOf(str: String, fromIndex: Int): Int = asDynamic().lastIndexOf(str, fromIndex)
|
||||
|
||||
@JsName("startsWith")
|
||||
internal external fun String.nativeStartsWith(s: String, position: Int): Boolean = noImpl
|
||||
internal inline fun String.nativeStartsWith(s: String, position: Int): Boolean = asDynamic().startsWith(s, position)
|
||||
|
||||
@JsName("endsWith")
|
||||
internal external fun String.nativeEndsWith(s: String): Boolean = noImpl
|
||||
internal inline fun String.nativeEndsWith(s: String): Boolean = asDynamic().endsWith(s)
|
||||
|
||||
@Deprecated("Use split(Regex) instead.", ReplaceWith("split(regex.toRegex()).toTypedArray()"))
|
||||
@library("splitString")
|
||||
@@ -26,18 +22,17 @@ public fun String.splitWithRegex(regex: String): Array<String> = noImpl
|
||||
@library("splitString")
|
||||
public fun String.splitWithRegex(regex: String, limit: Int): Array<String> = noImpl
|
||||
|
||||
public external fun String.substring(startIndex: Int): String = noImpl
|
||||
public inline fun String.substring(startIndex: Int): String = asDynamic().substring(startIndex)
|
||||
|
||||
public external fun String.substring(startIndex: Int, endIndex: Int): String = noImpl
|
||||
public inline fun String.substring(startIndex: Int, endIndex: Int): String = asDynamic().substring(startIndex, endIndex)
|
||||
|
||||
public external fun String.concat(str: String): String = noImpl
|
||||
public inline fun String.concat(str: String): String = asDynamic().concat(str)
|
||||
|
||||
public external fun String.match(regex: String): Array<String> = noImpl
|
||||
public inline fun String.match(regex: String): Array<String> = asDynamic().match(regex)
|
||||
|
||||
//native public fun String.trim() : String = noImpl
|
||||
//TODO: String.replace to implement effective trimLeading and trimTrailing
|
||||
|
||||
public inline val CharSequence.size: Int get() = asDynamic().length
|
||||
|
||||
@JsName("replace")
|
||||
internal external fun String.nativeReplace(pattern: RegExp, replacement: String): String = noImpl
|
||||
internal inline fun String.nativeReplace(pattern: RegExp, replacement: String): String = asDynamic().replace(pattern, replacement)
|
||||
|
||||
@@ -4,22 +4,22 @@ package jquery.ui
|
||||
//jquery UI
|
||||
import jquery.JQuery
|
||||
|
||||
public external fun JQuery.buttonset() : JQuery = noImpl;
|
||||
public inline fun JQuery.buttonset(): JQuery = asDynamic().buttonset()
|
||||
|
||||
public external fun JQuery.dialog() : JQuery = noImpl;
|
||||
public inline fun JQuery.dialog(): JQuery = asDynamic().dialog()
|
||||
|
||||
public external fun JQuery.dialog(params : Json) : JQuery = noImpl
|
||||
public inline fun JQuery.dialog(params: Json): JQuery = asDynamic().dialog(params)
|
||||
|
||||
public external fun JQuery.dialog(mode : String, param : String) : Any? = noImpl
|
||||
public inline fun JQuery.dialog(mode: String, param: String): Any? = asDynamic().dialog(mode, param)
|
||||
|
||||
public external fun JQuery.dialog(mode : String) : JQuery = noImpl
|
||||
public inline fun JQuery.dialog(mode: String): JQuery = asDynamic().dialog(mode)
|
||||
|
||||
public external fun JQuery.dialog(mode : String, param : String, value : Any?) : JQuery = noImpl
|
||||
public inline fun JQuery.dialog(mode: String, param: String, value: Any?): JQuery = asDynamic().dialog(mode, param, value)
|
||||
|
||||
public external fun JQuery.button() : JQuery = noImpl;
|
||||
public inline fun JQuery.button(): JQuery = asDynamic().button()
|
||||
|
||||
public external fun JQuery.accordion() : JQuery = noImpl
|
||||
public inline fun JQuery.accordion(): JQuery = asDynamic().accordion()
|
||||
|
||||
public external fun JQuery.draggable(params : Json) : JQuery = noImpl
|
||||
public inline fun JQuery.draggable(params: Json): JQuery = asDynamic().draggable(params)
|
||||
|
||||
public external fun JQuery.selectable() : JQuery = noImpl
|
||||
public inline fun JQuery.selectable(): JQuery = asDynamic().selectable()
|
||||
|
||||
@@ -7,7 +7,7 @@ import org.w3c.dom.Node
|
||||
public fun createDocument(): Document = Document()
|
||||
|
||||
@Deprecated("use member property outerHTML of Element class instead")
|
||||
public external val Node.outerHTML: String get() = noImpl
|
||||
public inline val Node.outerHTML: String get() = asDynamic().outerHTML
|
||||
|
||||
/** Converts the node to an XML String */
|
||||
@Deprecated("use outerHTML directly")
|
||||
|
||||
@@ -252,13 +252,13 @@ fun specialJS(): List<GenericFunction> {
|
||||
}
|
||||
|
||||
|
||||
templates add f("sort(comparison: (T, T) -> Int)") {
|
||||
templates add f("sort(noinline comparison: (T, T) -> Int)") {
|
||||
only(ArraysOfObjects, ArraysOfPrimitives)
|
||||
exclude(PrimitiveType.Boolean)
|
||||
external(true)
|
||||
inline(true)
|
||||
returns("Unit")
|
||||
doc { "Sorts the array in-place according to the order specified by the given [comparison] function." }
|
||||
body { "noImpl" }
|
||||
body { "asDynamic().sort(comparison)" }
|
||||
}
|
||||
|
||||
templates add f("sortWith(comparator: Comparator<in T>)") {
|
||||
|
||||
Reference in New Issue
Block a user