equal
deleted
inserted
replaced
384 { |
384 { |
385 require(remove.forall(name => !is_required(name))) |
385 require(remove.forall(name => !is_required(name))) |
386 copy(theories = theories -- remove) |
386 copy(theories = theories -- remove) |
387 } |
387 } |
388 |
388 |
389 lazy val theories_graph: Graph[Document.Node.Name, Unit] = |
389 lazy val theory_graph: Graph[Document.Node.Name, Unit] = |
390 { |
390 { |
391 val entries = |
391 val entries = |
392 for ((name, theory) <- theories.toList) |
392 for ((name, theory) <- theories.toList) |
393 yield ((name, ()), theory.node_header.imports.map(_._1).filter(theories.isDefinedAt(_))) |
393 yield ((name, ()), theory.node_header.imports.map(_._1).filter(theories.isDefinedAt(_))) |
394 Graph.make(entries, symmetric = true)(Document.Node.Name.Ordering) |
394 Graph.make(entries, symmetric = true)(Document.Node.Name.Ordering) |
461 def purge_theories(session: Session, nodes: Option[List[Document.Node.Name]]) |
461 def purge_theories(session: Session, nodes: Option[List[Document.Node.Name]]) |
462 : (List[Document.Node.Name], List[Document.Node.Name]) = |
462 : (List[Document.Node.Name], List[Document.Node.Name]) = |
463 { |
463 { |
464 state.change_result(st => |
464 state.change_result(st => |
465 { |
465 { |
466 val graph = st.theories_graph |
466 val graph = st.theory_graph |
467 val all_nodes = graph.topological_order |
467 val all_nodes = graph.topological_order |
468 |
468 |
469 val purge = |
469 val purge = |
470 (if (nodes.isEmpty) all_nodes else nodes.get.filter(graph.defined(_))). |
470 (if (nodes.isEmpty) all_nodes else nodes.get.filter(graph.defined(_))). |
471 filterNot(st.is_required(_)).toSet |
471 filterNot(st.is_required(_)).toSet |