From acab668c9da90b4217a83d926318496ce433a6a9 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Sun, 27 May 2018 01:40:58 -0400 Subject: [PATCH 1/2] Rename vars in Utility.combineAdjacentTextNodes --- shared/src/main/scala/scala/xml/Utility.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared/src/main/scala/scala/xml/Utility.scala b/shared/src/main/scala/scala/xml/Utility.scala index 88f6e8cd0..59169af71 100755 --- a/shared/src/main/scala/scala/xml/Utility.scala +++ b/shared/src/main/scala/scala/xml/Utility.scala @@ -52,8 +52,8 @@ object Utility extends AnyRef with parsing.TokenTests { private def combineAdjacentTextNodes(children: Node*): Seq[Node] = { children.foldRight(Seq.empty[Node]) { - case (Text(left), Text(right) +: accMinusLast) => Text(left + right) +: accMinusLast - case (n, acc) => n +: acc + case (Text(left), Text(right) +: nodes) => Text(left + right) +: nodes + case (n, nodes) => n +: nodes } } From 1a3b7518cc84a180455ccce43aa01e98334298a1 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Sun, 27 May 2018 01:44:25 -0400 Subject: [PATCH 2/2] Drop varargs with Utility.combineAdjacentTextNodes --- shared/src/main/scala/scala/xml/Utility.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/shared/src/main/scala/scala/xml/Utility.scala b/shared/src/main/scala/scala/xml/Utility.scala index 59169af71..bd974b3e7 100755 --- a/shared/src/main/scala/scala/xml/Utility.scala +++ b/shared/src/main/scala/scala/xml/Utility.scala @@ -46,11 +46,11 @@ object Utility extends AnyRef with parsing.TokenTests { */ def trim(x: Node): Node = x match { case Elem(pre, lab, md, scp, child@_*) => - val children = combineAdjacentTextNodes(child:_*) flatMap trimProper + val children = combineAdjacentTextNodes(child) flatMap trimProper Elem(pre, lab, md, scp, children.isEmpty, children: _*) } - private def combineAdjacentTextNodes(children: Node*): Seq[Node] = { + private def combineAdjacentTextNodes(children: Seq[Node]): Seq[Node] = { children.foldRight(Seq.empty[Node]) { case (Text(left), Text(right) +: nodes) => Text(left + right) +: nodes case (n, nodes) => n +: nodes @@ -63,7 +63,7 @@ object Utility extends AnyRef with parsing.TokenTests { */ def trimProper(x: Node): Seq[Node] = x match { case Elem(pre, lab, md, scp, child@_*) => - val children = combineAdjacentTextNodes(child:_*) flatMap trimProper + val children = combineAdjacentTextNodes(child) flatMap trimProper Elem(pre, lab, md, scp, children.isEmpty, children: _*) case Text(s) => new TextBuffer().append(s).toText