[JS] Refactor and comment for typeOf fix

This commit is contained in:
Svyatoslav Kuzmich
2019-11-12 16:17:44 +03:00
parent dc336c3c8a
commit ea8ade0852
2 changed files with 6 additions and 2 deletions
@@ -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 ->