[JS] Refactor and comment for typeOf fix
This commit is contained in:
@@ -5,8 +5,9 @@
|
|||||||
|
|
||||||
import kotlin.reflect.typeOf
|
import kotlin.reflect.typeOf
|
||||||
|
|
||||||
|
var x: Int = 1
|
||||||
fun sideEffects() {
|
fun sideEffects() {
|
||||||
println("Side effect")
|
x++
|
||||||
}
|
}
|
||||||
|
|
||||||
inline fun <reified T> foo(): String {
|
inline fun <reified T> foo(): String {
|
||||||
|
|||||||
@@ -26,7 +26,10 @@ fun substituteKTypes(root: JsNode) {
|
|||||||
visitor.accept(root)
|
visitor.accept(root)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get KType from expression or from staticRef of referenced name
|
// Get KType from expression or from staticRef of referenced name.
|
||||||
|
// kType metadata is set on jsClass expressions.
|
||||||
|
// There can be a chain of local variables from jsClass to its usage.
|
||||||
|
// This methods uses staticRef to find the original expression with kType metadata.
|
||||||
fun getTransitiveKType(e: JsExpression): JsExpression? {
|
fun getTransitiveKType(e: JsExpression): JsExpression? {
|
||||||
return when {
|
return when {
|
||||||
e.kType != null ->
|
e.kType != null ->
|
||||||
|
|||||||
Reference in New Issue
Block a user