From d1225fc61990d76a95e8fbb2bf386beef7456e0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E5=88=BA=E8=9E=88?= Date: Mon, 7 Apr 2025 11:08:15 +0800 Subject: [PATCH] perf: rm list.removeLast api --- .../commonMain/kotlin/li/songe/selector/parser/AstParser.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/selector/src/commonMain/kotlin/li/songe/selector/parser/AstParser.kt b/selector/src/commonMain/kotlin/li/songe/selector/parser/AstParser.kt index 868b6ee6..1ce5fc95 100644 --- a/selector/src/commonMain/kotlin/li/songe/selector/parser/AstParser.kt +++ b/selector/src/commonMain/kotlin/li/songe/selector/parser/AstParser.kt @@ -29,7 +29,7 @@ internal class AstParser(override val source: String) : SelectorParser(source) { private fun traverse(block: (node: AstNode<*>) -> Unit) { val stack = mutableListOf(tempAstContext.children.single()) do { - val top = stack.removeLast() + val top = stack.run { removeAt(lastIndex) } block(top) stack.addAll(top.children.asReversed()) } while (stack.isNotEmpty()) @@ -154,7 +154,7 @@ internal class AstParser(override val source: String) : SelectorParser(source) { tempAstContext.children.size ).toMutableList() repeat(children.size) { - tempAstContext.children.removeLast() + tempAstContext.children.run { removeAt(lastIndex) } } tempAstContext.children.add( AstNode( @@ -173,7 +173,7 @@ internal class AstParser(override val source: String) : SelectorParser(source) { tempAstContext.children.size ).toMutableList() repeat(children.size) { - tempAstContext.children.removeLast() + tempAstContext.children.run { removeAt(lastIndex) } } tempAstContext.children.add( AstNode(