+loadDecl decls_map (version, decl)
+ = getDeclBinders new_name decl `thenRn` \ maybe_avail ->
+ case maybe_avail of {
+ Nothing -> returnRn decls_map; -- No bindings
+ Just avail ->
+
+ getDeclSysBinders new_name decl `thenRn` \ sys_bndrs ->
+ let
+ main_name = availName avail
+ new_decls_map = foldl add_decl decls_map
+ [ (name, (version,avail,decl',name==main_name))
+ | name <- sys_bndrs ++ availNames avail]
+ add_decl decls_map (name, stuff)
+ = WARN( name `elemNameEnv` decls_map, ppr name )
+ addToNameEnv decls_map name stuff
+ in
+ returnRn new_decls_map
+ }
+ where
+ new_name rdr_name loc = newImportedGlobalFromRdrName rdr_name
+ {-
+ If a signature decl is being loaded, and optIgnoreIfacePragmas is on,
+ we toss away unfolding information.
+
+ Also, if the signature is loaded from a module we're importing from source,
+ we do the same. This is to avoid situations when compiling a pair of mutually
+ recursive modules, peering at unfolding info in the interface file of the other,
+ e.g., you compile A, it looks at B's interface file and may as a result change
+ its interface file. Hence, B is recompiled, maybe changing its interface file,
+ which will the unfolding info used in A to become invalid. Simple way out is to
+ just ignore unfolding info.
+
+ [Jan 99: I junked the second test above. If we're importing from an hi-boot
+ file there isn't going to *be* any pragma info. Maybe the above comment
+ dates from a time where we picked up a .hi file first if it existed?]
+ -}
+ decl' =
+ case decl of
+ SigD (IfaceSig name tp ls loc) | opt_IgnoreIfacePragmas ->
+ SigD (IfaceSig name tp [] loc)
+ _ -> decl
+
+loadInstDecl :: Bag IfaceInst