-getModuleHiMap :: IfaceFlavour -> RnMG ModuleHiMap
-getModuleHiMap as_source rn_down (GDown himap hibmap iface_var)
- = case as_source of
- HiBootFile -> returnSST hibmap
- _ -> returnSST himap
+getModuleHiMap :: Bool -> RnM s d ModuleHiMap
+getModuleHiMap want_hi_boot (RnDown {rn_hi_map = himap, rn_hiboot_map = hibmap}) _
+ | want_hi_boot = returnSST hibmap
+ | otherwise = returnSST himap
+\end{code}
+
+The interface file format is capable of distinguishing
+between normal imports/exports of names from other modules
+and 'hi-boot' mentions of names, with the flavour in the
+being encoded inside a @Module@.
+
+@setModuleFlavourRn@ fixes up @Module@ values containing
+normal flavours, checking to see whether
+
+\begin{code}
+setModuleFlavourRn :: Module -> RnM s d Module
+setModuleFlavourRn mod
+ | bootFlavour hif = returnRn mod
+ | otherwise =
+ getModuleHiMap (bootFlavour hif) `thenRn` \ himap ->
+ let mod_pstr = moduleString mod in
+ case (lookupFM himap mod_pstr) of
+ Nothing -> returnRn mod
+ Just (_,is_in_a_dll) ->
+ returnRn (setModuleFlavour (mkDynFlavour is_in_a_dll hif) mod)
+ where
+ hif = moduleIfaceFlavour mod