override fun visitComposable()

in rules/common/src/main/kotlin/com/twitter/compose/rules/ComposeRememberMissing.kt [14:28]


    override fun visitComposable(function: KtFunction, autoCorrect: Boolean, emitter: Emitter) {
        // To keep memory consumption in check, we first traverse down until we see one of our known functions
        // that need remembering
        function.findChildrenByClass<KtCallExpression>()
            .filter { MethodsThatNeedRemembering.contains(it.calleeExpression?.text) }
            // Only for those, we traverse up to [function], to see if it was actually remembered
            .filterNot { it.isRemembered(function) }
            // If it wasn't, we show the error
            .forEach { callExpression ->
                when (callExpression.calleeExpression!!.text) {
                    "mutableStateOf" -> emitter.report(callExpression, MutableStateOfNotRemembered, false)
                    "derivedStateOf" -> emitter.report(callExpression, DerivedStateOfNotRemembered, false)
                }
            }
    }