Skip to content

Commit 5e23968

Browse files
committed
Merge pull request #81 from ashawley/use-nodeseq-constructor
Use NodeSeq.fromSeq instead of new NodeSeq { val theSeq = ... }
2 parents c1dbf44 + b74cf51 commit 5e23968

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests {
443443
val ts = new NodeBuffer
444444
var exit = eof
445445
// todo: optimize seq repr.
446-
def done = new NodeSeq { val theSeq = ts.toList }
446+
def done = NodeSeq.fromSeq(ts.toList)
447447

448448
while (!exit) {
449449
tmppos = pos

src/test/scala/scala/xml/PatternMatching.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class PatternMatching extends {
7474
<title>Baaaaaaalabla</title>
7575
</bks>;
7676

77-
assertTrue(new NodeSeq { val theSeq = books.child } match {
77+
assertTrue(NodeSeq.fromSeq(books.child) match {
7878
case t @ Seq(<title>Blabla</title>) => false
7979
case _ => true
8080
})
@@ -110,4 +110,4 @@ class PatternMatching extends {
110110
case (ser: Serializable, "foo") => false
111111
})
112112
}
113-
}
113+
}

src/test/scala/scala/xml/XMLTest.scala

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class XMLTest {
3737
Text(x.attributes("value").toString + y.attributes("bazValue").toString + "!")
3838
};
3939

40-
val pelems_2 = new NodeSeq { val theSeq = List(Text("38!"), Text("58!")) };
40+
val pelems_2 = NodeSeq.fromSeq(List(Text("38!"), Text("58!")));
4141
assertTrue(pelems_1 sameElements pelems_2)
4242
assertTrue(Text("8") sameElements (p \\ "@bazValue"))
4343
}
@@ -94,7 +94,7 @@ class XMLTest {
9494
assertEquals(results1Expected, results1)
9595

9696
{
97-
val actual = for (t @ <book><title>Blabla</title></book> <- new NodeSeq { val theSeq = books.child }.toList)
97+
val actual = for (t @ <book><title>Blabla</title></book> <- NodeSeq.fromSeq(books.child).toList)
9898
yield t
9999
val expected = List(<book><title>Blabla</title></book>)
100100
assertEquals(expected, actual)
@@ -312,7 +312,7 @@ class XMLTest {
312312
(parsedxml2 \\ "book") { n: Node => (n \ "title") xml_== "Data on ze web" } toString)
313313

314314
assertTrue(
315-
((new NodeSeq { val theSeq = List(parsedxml2) }) \\ "_") sameElements List(
315+
((NodeSeq.fromSeq(List(parsedxml2))) \\ "_") sameElements List(
316316
Elem(null, "bib", e, sc,
317317
Elem(null, "book", e, sc,
318318
Elem(null, "author", e, sc, Text("Peter Buneman")),

0 commit comments

Comments
 (0)