Skip to content

Commit

Permalink
Fixed runtime issue in Kotlin code
Browse files Browse the repository at this point in the history
  • Loading branch information
spacecowboy committed Sep 22, 2024
1 parent c8440a9 commit 050f3cf
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class LinearTextBuilder : Appendable {
fun pop() {
check(annotationsStack.isNotEmpty()) { "No annotation to pop" }
// pop the last element
val item = annotationsStack.removeLast()
val item = annotationsStack.removeAt(annotationsStack.lastIndex)
item.end = text.lastIndex
}

Expand Down Expand Up @@ -190,7 +190,7 @@ private fun CharSequence.secondToLast(): Char {
private fun <T> MutableList<T>.pushMaxTwo(item: T) {
this.add(0, item)
if (count() > 2) {
this.removeLast()
this.removeAt(this.lastIndex)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ private fun CharSequence.secondToLast(): Char {
private fun <T> MutableList<T>.pushMaxTwo(item: T) {
this.add(0, item)
if (count() > 2) {
this.removeLast()
this.removeAt(this.lastIndex)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ abstract class HtmlParser {
annotation: String,
): Int = builder.pushStringAnnotation(tag = tag, annotation = annotation)

fun popSpan() = spanStack.removeLast()
fun popSpan() = spanStack.removeAt(spanStack.lastIndex)
}

inline fun <R : Any> HtmlParser.withParagraph(crossinline block: HtmlParser.() -> R): R {
Expand Down

0 comments on commit 050f3cf

Please sign in to comment.