Skip to content

Commit 4d58e59

Browse files
committed
Don't pass NodeBuffer as Seq[Node]
1 parent 3861cbd commit 4d58e59

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

shared/src/main/scala/scala/xml/Document.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class Document extends NodeSeq with Serializable {
3636
* excluded. If there is a document type declaration, the list also
3737
* contains a document type declaration information item.
3838
*/
39-
var children: Seq[Node] = _
39+
var children: Seq[Node] = _ // effectively an `immutable.Seq`, not changed due to binary compatibility
4040

4141
/** The element information item corresponding to the document element. */
4242
var docElem: Node = _

shared/src/main/scala/scala/xml/Utility.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ object Utility extends AnyRef with parsing.TokenTests {
354354
null
355355
}
356356

357+
// unused, untested
357358
def parseAttributeValue(value: String): Seq[Node] = {
358359
val sb: StringBuilder = new StringBuilder
359360
var rfb: StringBuilder = null
@@ -398,7 +399,7 @@ object Utility extends AnyRef with parsing.TokenTests {
398399
else
399400
nb += x
400401
}
401-
nb
402+
nb.toVector
402403
}
403404

404405
/**

shared/src/main/scala/scala/xml/parsing/MarkupParser.scala

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests {
242242
}
243243

244244
nextch() // is prolog ?
245-
var children: NodeSeq = null
245+
var children: Seq[Node] = null
246246
if ('?' == ch) {
247247
nextch()
248248
info_prolog = prolog()
@@ -255,7 +255,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests {
255255
val ts: NodeBuffer = new NodeBuffer()
256256
content1(TopScope, ts) // DTD handled as side effect
257257
ts &+ content(TopScope)
258-
children = NodeSeq.fromSeq(ts)
258+
children = ts.toVector
259259
}
260260
//println("[MarkupParser::document] children now: "+children.toList)
261261
var elemCount: Int = 0
@@ -451,8 +451,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests {
451451
def content(pscope: NamespaceBinding): NodeSeq = {
452452
val ts: NodeBuffer = new NodeBuffer
453453
var exit: Boolean = eof
454-
// todo: optimize seq repr.
455-
def done: NodeSeq = NodeSeq.fromSeq(ts.toList)
454+
def done: NodeSeq = NodeSeq.fromSeq(ts.toVector)
456455

457456
while (!exit) {
458457
tmppos = pos

0 commit comments

Comments
 (0)