@@ -219,17 +219,16 @@ object Utility extends AnyRef with parsing.TokenTests {
219
219
minimizeTags : MinimizeMode .Value ,
220
220
sb : StringBuilder
221
221
): Unit = {
222
- @ tailrec def ser (nss : List [Seq [Node ]], pscopes : List [NamespaceBinding ], spaced : List [Boolean ], toClose : List [Node ]): Unit = nss match {
223
- case List (ns) if ns.isEmpty =>
224
- case ns :: rests if ns.isEmpty =>
222
+ @ tailrec def ser (nss : List [List [Node ]], pscopes : List [NamespaceBinding ], spaced : List [Boolean ], toClose : List [Node ]): Unit = nss match {
223
+ case List (Nil ) =>
224
+ case Nil :: rests =>
225
225
if (toClose.head != null ) {
226
226
sb.append(" </" )
227
227
toClose.head.nameToString(sb)
228
228
sb.append('>' )
229
229
}
230
230
ser(rests, pscopes.tail, spaced.tail, toClose.tail)
231
- case ns1 :: r =>
232
- val (n, ns) = (ns1.head, ns1.tail)
231
+ case (n :: ns) :: r =>
233
232
def sp (): Unit = if (ns.nonEmpty && spaced.head) sb.append(' ' )
234
233
n match {
235
234
case c : Comment =>
@@ -243,7 +242,7 @@ object Utility extends AnyRef with parsing.TokenTests {
243
242
sp()
244
243
ser(ns :: r, pscopes, spaced, toClose)
245
244
case g : Group =>
246
- ser(g.nodes :: ns :: r, g.scope :: pscopes, false :: spaced, null :: toClose)
245
+ ser(g.nodes.toList :: ns :: r, g.scope :: pscopes, false :: spaced, null :: toClose)
247
246
case e : Elem =>
248
247
sb.append('<' )
249
248
e.nameToString(sb)
@@ -259,12 +258,12 @@ object Utility extends AnyRef with parsing.TokenTests {
259
258
} else {
260
259
sb.append('>' )
261
260
val csp = e.child.forall(isAtomAndNotText)
262
- ser(e.child :: ns :: r, e.scope :: pscopes, csp :: spaced, e :: toClose)
261
+ ser(e.child.toList :: ns :: r, e.scope :: pscopes, csp :: spaced, e :: toClose)
263
262
}
264
263
case n => throw new IllegalArgumentException (" Don't know how to serialize a " + n.getClass.getName)
265
264
}
266
265
}
267
- ser(List (ns), List (pscope), List (spaced), Nil )
266
+ ser(List (ns.toList ), List (pscope), List (spaced), Nil )
268
267
}
269
268
270
269
def sequenceToXML (
0 commit comments