override fun toCode()

in build-logic/generatorlegacybuild/src/main/kotlin/karakum/query/Property.kt [12:24]


    override fun toCode(): String {
        if (name == "children" && type == "react.ReactNode")
            return "override var children: react.ReactNode?"

        val optional = source.startsWith("$name?: ")
                && type != "Void"
                && type != "Any?"
        val typeDeclaration = if (optional && (") -> " in type || !type.endsWith(">?"))) {
            if (type.startsWith("(")) "($type)?" else "$type?"
        } else type

        return "$modifiers ${if (isVar) "var" else "val"} ${safeName(name)}: $typeDeclaration"
    }