src/Pure/Tools/codegen_thingol.ML
changeset 19616 2545e8ab59a5
parent 19607 07eeb832f28d
child 19785 52d71ee5c8a8
equal deleted inserted replaced
19615:e3ab6cd838a4 19616:2545e8ab59a5
   614           (Module o Graph.map_nodes mapp) modl
   614           (Module o Graph.map_nodes mapp) modl
   615   in dest_modl o mapp o Module end;
   615   in dest_modl o mapp o Module end;
   616 
   616 
   617 fun fold_defs f =
   617 fun fold_defs f =
   618   let
   618   let
   619     fun fol prfix (name, Def def) =
   619     fun fol prfix (name, (Def def, _)) =
   620           f (NameSpace.pack (prfix @ [name]), def)
   620           f (NameSpace.pack (prfix @ [name]), def)
   621       | fol prfix (name, Module modl) =
   621       | fol prfix (name, (Module modl, _)) =
   622           Graph.fold_nodes (fol (prfix @ [name])) modl
   622           Graph.fold (fol (prfix @ [name])) modl
   623   in Graph.fold_nodes (fol []) end;
   623   in Graph.fold (fol []) end;
   624 
   624 
   625 fun add_deps f modl =
   625 fun add_deps f modl =
   626   modl
   626   modl
   627   |> fold add_dep ([] |> fold_defs (append o f) modl);
   627   |> fold add_dep ([] |> fold_defs (append o f) modl);
   628 
   628 
   740 
   740 
   741 fun imports_of modl name =
   741 fun imports_of modl name =
   742   let
   742   let
   743     (*fun submodules prfx modl =
   743     (*fun submodules prfx modl =
   744       cons prfx
   744       cons prfx
   745       #> Graph.fold_nodes
   745       #> Graph.fold
   746           (fn (m, Module modl) => submodules (prfx @ [m]) modl
   746           (fn (m, (Module modl, _)) => submodules (prfx @ [m]) modl
   747             | (_, Def _) => I) modl;
   747             | (_, (Def _, _)) => I) modl;
   748     fun get_modl name =
   748     fun get_modl name =
   749       fold (fn n => fn modl => (dest_modl oo Graph.get_node) modl n) name modl*)
   749       fold (fn n => fn modl => (dest_modl oo Graph.get_node) modl n) name modl*)
   750     fun imports prfx [] modl =
   750     fun imports prfx [] modl =
   751           []
   751           []
   752       | imports prfx (m::ms) modl =
   752       | imports prfx (m::ms) modl =