Skip to content

Commit ae9a10c

Browse files
Remove redundant comments regarding invariants in concat function of Parser.kt.
1 parent 72e8b12 commit ae9a10c

File tree

1 file changed

+0
-3
lines changed
  • core/common/src/internal/format/parser

1 file changed

+0
-3
lines changed

core/common/src/internal/format/parser/Parser.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ internal class ParserStructure<in Output>(
4646
* Simplifies the result by merging number spans and handling unconditional modifications.
4747
*/
4848
internal fun <T> List<ParserStructure<T>>.concat(): ParserStructure<T> {
49-
// Invariant: only called when simplifiedParserStructure.operations is non-empty
5049
fun mergeOperations(
5150
baseOperations: List<ParserOperation<T>>,
5251
numberSpan: List<NumberConsumer<T>>?,
@@ -116,7 +115,6 @@ internal fun <T> List<ParserStructure<T>>.concat(): ParserStructure<T> {
116115
listOf(simplified)
117116
}.ifEmpty {
118117
if (other.operations.isNotEmpty()) {
119-
// The invariant is preserved: other.operations is non-empty
120118
return mergeOperations(newOperations, currentNumberSpan, unconditionalModifications, other)
121119
}
122120
// [other] has no operations, just alternatives; use them as our tails
@@ -132,7 +130,6 @@ internal fun <T> List<ParserStructure<T>>.concat(): ParserStructure<T> {
132130
ParserStructure(newOperations, mergedTails)
133131
} else {
134132
// Distribute number span across alternatives that start with number spans
135-
// The invariant is preserved: the structure coming from the recursive [simplifyAndAppend] calls
136133
val newTails = mergedTails.map { structure ->
137134
mergeOperations(emptyList(), currentNumberSpan, unconditionalModifications, structure)
138135
}

0 commit comments

Comments
 (0)