JS: generate temporary names for function parameters. Remove tests for js() function that references parameters. Remove such usages of js() function from stdlib
This commit is contained in:
@@ -30,7 +30,7 @@ public class Enum<T : Enum<T>> : Comparable<Enum<T>> {
|
||||
|
||||
override fun equals(other: Any?) = this === other
|
||||
|
||||
override fun hashCode(): Int = js("Kotlin.identityHashCode(this)")
|
||||
override fun hashCode(): Int = js("Kotlin.identityHashCode")(this)
|
||||
|
||||
override fun toString() = name
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
internal abstract class BaseOutput {
|
||||
@JsName("println")
|
||||
open fun println(a: Any?) {
|
||||
if (js("typeof a") !== "undefined") {
|
||||
if (jsTypeOf(a) != "undefined") {
|
||||
print(a)
|
||||
}
|
||||
print("\n")
|
||||
@@ -43,7 +43,7 @@ internal class OutputToConsoleLog : BaseOutput() {
|
||||
}
|
||||
|
||||
override fun println(a: Any?) {
|
||||
console.log(if (js("typeof a") !== "undefined") a else "")
|
||||
console.log(if (jsTypeOf(a) != "undefined") a else "")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,4 +85,4 @@ internal var `out` = {
|
||||
if (isNode) NodeJsOutput(js("process.stdout")) else BufferedOutputToConsoleLog()
|
||||
}()
|
||||
|
||||
private inline fun String(value: Any?): String = js("String(value)")
|
||||
private inline fun String(value: Any?): String = js("String")(value)
|
||||
|
||||
@@ -32,7 +32,7 @@ public external fun js(code: String): dynamic = noImpl
|
||||
/**
|
||||
* Function corresponding to JavaScript's `typeof` operator
|
||||
*/
|
||||
public inline fun jsTypeOf(a: Any?): String = js("typeof a")
|
||||
public inline fun jsTypeOf(a: Any?): String = js("Kotlin").jsTypeOf(a)
|
||||
|
||||
@library
|
||||
internal fun deleteProperty(`object`: Any, property: Any): Unit = noImpl
|
||||
@@ -30,7 +30,7 @@ public operator fun dynamic.iterator(): Iterator<dynamic> {
|
||||
return when {
|
||||
this["iterator"] != null ->
|
||||
this["iterator"]()
|
||||
js("Array.isArray(r)") ->
|
||||
js("Array").isArray(r) ->
|
||||
r.unsafeCast<Array<*>>().iterator()
|
||||
|
||||
else ->
|
||||
|
||||
Reference in New Issue
Block a user