--- a/src/Pure/General/xml.scala Fri Dec 18 15:33:44 2009 +0100
+++ b/src/Pure/General/xml.scala Fri Dec 18 16:52:36 2009 +0100
@@ -123,10 +123,12 @@
case None => store(x)
}
def cache_props(x: List[(String, String)]): List[(String, String)] =
- lookup(x) match {
- case Some(y) => y
- case None => store(x.map(p => (cache_string(p._1), cache_string(p._2))))
- }
+ if (x.isEmpty) x
+ else
+ lookup(x) match {
+ case Some(y) => y
+ case None => store(x.map(p => (cache_string(p._1), cache_string(p._2))))
+ }
def cache_tree(x: XML.Tree): XML.Tree =
lookup(x) match {
case Some(y) => y
@@ -138,10 +140,12 @@
}
}
def cache_trees(x: List[XML.Tree]): List[XML.Tree] =
- lookup(x) match {
- case Some(y) => y
- case None => x.map(cache_tree(_))
- }
+ if (x.isEmpty) x
+ else
+ lookup(x) match {
+ case Some(y) => y
+ case None => x.map(cache_tree(_))
+ }
}