Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 91f84a4b authored by Automerger Merge Worker's avatar Automerger Merge Worker Committed by Android (Google) Code Review
Browse files

Merge "Merge "Fix assignment for last element in codegen list" into main am:...

Merge "Merge "Fix assignment for last element in codegen list" into main am: 12e1764d am: 7f966b51" into main
parents 028645f7 f3ff901b
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -238,7 +238,7 @@ class FileInfo(
                    } else if (classBounds.isDataclass) {

                        // Insert placeholder for generated code to be inserted for the 1st time
                        chunks.last = (chunks.last as Code)
                        chunks[chunks.lastIndex] = (chunks.last() as Code)
                                .lines
                                .dropLastWhile { it.isBlank() }
                                .run {
+1 −11
Original line number Diff line number Diff line
@@ -137,14 +137,4 @@ private fun parseFailed(source: String, cause: Throwable? = null, desc: String =
            cause)
}

var <T> MutableList<T>.last
    get() = last()
    set(value) {
        if (isEmpty()) {
            add(value)
        } else {
            this[size - 1] = value
        }
    }

inline fun <T> buildList(init: MutableList<T>.() -> Unit) = mutableListOf<T>().apply(init)