toplevel deresolving for flat module name space
authorhaftmann
Thu Nov 25 15:40:15 2010 +0100 (2010-11-25)
changeset 4070503f1266a066e
parent 40691 a68f64f99832
child 40706 fed0251b7939
toplevel deresolving for flat module name space
src/Tools/Code/code_haskell.ML
src/Tools/Code/code_namespace.ML
     1.1 --- a/src/Tools/Code/code_haskell.ML	Thu Nov 25 00:32:30 2010 +0100
     1.2 +++ b/src/Tools/Code/code_haskell.ML	Thu Nov 25 15:40:15 2010 +0100
     1.3 @@ -362,7 +362,7 @@
     1.4    in
     1.5      Code_Target.serialization
     1.6        (fn width => fn destination => K () o map (write_module width destination))
     1.7 -      (fn present => fn width => rpair (fn _ => error "no deresolving")
     1.8 +      (fn present => fn width => rpair (try (deresolver ""))
     1.9          o format present width o Pretty.chunks o map snd)
    1.10        (map (uncurry print_module_frame o apsnd single) includes
    1.11          @ map (fn module_name => print_module module_name (Graph.get_node haskell_program module_name))
     2.1 --- a/src/Tools/Code/code_namespace.ML	Thu Nov 25 00:32:30 2010 +0100
     2.2 +++ b/src/Tools/Code/code_namespace.ML	Thu Nov 25 15:40:15 2010 +0100
     2.3 @@ -121,9 +121,11 @@
     2.4      val deresolver_tab = Symtab.make (AList.make
     2.5        (uncurry classify_names o Graph.get_node flat_program)
     2.6          (Graph.keys flat_program));
     2.7 -    fun deresolver module_name name =
     2.8 -      the (Symtab.lookup (the (Symtab.lookup deresolver_tab module_name)) name)
     2.9 -      handle Option => error ("Unknown statement name: " ^ labelled_name name);
    2.10 +    fun deresolver "" name =
    2.11 +          Long_Name.append (fst (dest_name name)) (base_deresolver name)
    2.12 +      | deresolver module_name name =
    2.13 +          the (Symtab.lookup (the (Symtab.lookup deresolver_tab module_name)) name)
    2.14 +          handle Option => error ("Unknown statement name: " ^ labelled_name name);
    2.15  
    2.16    in { deresolver = deresolver, flat_program = flat_program } end;
    2.17