src/Pure/PIDE/resources.scala
changeset 69393 ed0824ef337e
parent 69255 800b1ce96fce
child 69560 195371990820
--- a/src/Pure/PIDE/resources.scala	Mon Dec 03 12:30:37 2018 +0100
+++ b/src/Pure/PIDE/resources.scala	Mon Dec 03 14:59:42 2018 +0100
@@ -156,10 +156,7 @@
   def with_thy_reader[A](name: Document.Node.Name, f: Reader[Char] => A): A =
   {
     val path = name.path
-    if (path.is_file) {
-      val reader = Scan.byte_reader(path.file)
-      try { f(reader) } finally { reader.close }
-    }
+    if (path.is_file) using(Scan.byte_reader(path.file))(f)
     else if (name.node == name.theory)
       error("Cannot load theory " + quote(name.theory))
     else error ("Cannot load theory file " + path)