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

Skip to content
Snippets Groups Projects
Commit 815016a6 authored by Sorin Basca's avatar Sorin Basca
Browse files

Fix assignment for last element in codegen list

Bug: 322973175
Test: TH
Change-Id: Ib55bea6050e0d125c0d7d4821d75101085ab48af
parent 5bb6f919
Branches
No related tags found
No related merge requests found
...@@ -238,7 +238,7 @@ class FileInfo( ...@@ -238,7 +238,7 @@ class FileInfo(
} else if (classBounds.isDataclass) { } else if (classBounds.isDataclass) {
// Insert placeholder for generated code to be inserted for the 1st time // 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 .lines
.dropLastWhile { it.isBlank() } .dropLastWhile { it.isBlank() }
.run { .run {
...@@ -286,4 +286,4 @@ class FileInfo( ...@@ -286,4 +286,4 @@ class FileInfo(
.let { addAll(it) } .let { addAll(it) }
} }
} }
} }
\ No newline at end of file
...@@ -137,14 +137,4 @@ private fun parseFailed(source: String, cause: Throwable? = null, desc: String = ...@@ -137,14 +137,4 @@ private fun parseFailed(source: String, cause: Throwable? = null, desc: String =
cause) cause)
} }
var <T> MutableList<T>.last inline fun <T> buildList(init: MutableList<T>.() -> Unit) = mutableListOf<T>().apply(init)
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)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment