clarified signature: more operations;
authorwenzelm
Wed, 04 Jan 2023 16:06:46 +0100
changeset 76909 e6f324723308
parent 76908 4ef86dfe2296
child 76910 c27fcf4a7495
clarified signature: more operations;
src/Pure/Thy/export.scala
--- a/src/Pure/Thy/export.scala	Wed Jan 04 15:53:36 2023 +0100
+++ b/src/Pure/Thy/export.scala	Wed Jan 04 16:06:46 2023 +0100
@@ -423,6 +423,14 @@
     def theory(theory: String, other_cache: Option[Term.Cache] = None): Theory_Context =
       new Theory_Context(session_context, theory, other_cache)
 
+    def read_file(name: String): Option[Sessions.Source_File] = {
+      val store = database_context.store
+      (for {
+        database <- db_hierarchy.iterator
+        file <- store.read_sources(database.db, database.session, name = name).iterator
+      } yield file).nextOption()
+    }
+
     def node_source(name: Document.Node.Name): String = {
       def snapshot_source: Option[String] =
         for {
@@ -431,12 +439,8 @@
           text = node.source if text.nonEmpty
         } yield text
 
-      val store = database_context.store
       def db_source: Option[String] =
-        (for {
-          database <- db_hierarchy.iterator
-          file <- store.read_sources(database.db, database.session, name = name.node).iterator
-        } yield file.text).nextOption()
+        read_file(name.node).map(_.text)
 
       snapshot_source orElse db_source getOrElse ""
     }