module CmTypes (
Unlinked(..), isObject, nameOfObject, isInterpretable,
Linkable(..),
- ModSummary(..), name_of_summary
+ ModSummary(..), ms_allimps, name_of_summary, pprSummaryTime
) where
import Interpreter
import HscTypes
import Module
-import CmStaticInfo
+--import CmStaticInfo
import Outputable
+import Time ( ClockTime )
+
+
data Unlinked
= DotO FilePath
| DotA FilePath
| DotDLL FilePath
- | Trees [UnlinkedIBind] ItblEnv -- bunch of interpretable bindings, +
- -- a mapping from DataCons to their itbls
+ | BCOs [UnlinkedBCO] ItblEnv -- bunch of interpretable bindings, +
+ -- a mapping from DataCons to their itbls
instance Outputable Unlinked where
ppr (DotO path) = text "DotO" <+> text path
ppr (DotA path) = text "DotA" <+> text path
ppr (DotDLL path) = text "DotDLL" <+> text path
- ppr (Trees binds _) = text "Trees" <+> ppr binds
+ ppr (BCOs bcos _) = text "BCOs" <+> vcat (map ppr bcos)
isObject (DotO _) = True
isObject (DotA _) = True
nameOfObject (DotA fn) = fn
nameOfObject (DotDLL fn) = fn
-isInterpretable (Trees _ _) = True
-isInterpretable _ = False
+isInterpretable (BCOs _ _) = True
+isInterpretable _ = False
-data Linkable
- = LM ModuleName [Unlinked]
- | LP PackageName
+data Linkable = LM {
+ linkableTime :: ClockTime,
+ linkableModName :: ModuleName,
+ linkableUnlinked :: [Unlinked]
+ }
instance Outputable Linkable where
- ppr (LM mod_nm unlinkeds) = text "LinkableM" <+> ppr mod_nm <+> ppr unlinkeds
- ppr (LP package_nm) = text "LinkableP" <+> ptext package_nm
+ ppr (LM when_made mod_nm unlinkeds)
+ = text "LinkableM" <+> parens (text (show when_made)) <+> ppr mod_nm
+ <+> ppr unlinkeds
-- The ModuleLocation contains both the original source filename and the
-- filename of the cleaned-up source file after all preprocessing has been
data ModSummary
= ModSummary {
ms_mod :: Module, -- name, package
- ms_location :: ModuleLocation, -- location
+ ms_location :: ModuleLocation, -- location
ms_srcimps :: [ModuleName], -- source imports
- ms_imps :: [ModuleName] -- non-source imports
- --ms_date :: Maybe ClockTime -- timestamp of summarised
- -- file, if home && source
+ ms_imps :: [ModuleName], -- non-source imports
+ ms_hs_date :: Maybe ClockTime -- timestamp of summarised
+ -- file, if home && source
}
instance Outputable ModSummary where
ppr ms
- = sep [--text "ModSummary { ms_date = " <> text (show ms_date),
- text "ModSummary {",
- nest 3 (sep [text "ms_mod =" <+> ppr (ms_mod ms) <> comma,
+ = sep [text "ModSummary {",
+ nest 3 (sep [text "ms_hs_date = " <> text (show (ms_hs_date ms)),
+ text "ms_mod =" <+> ppr (ms_mod ms) <> comma,
text "ms_imps =" <+> ppr (ms_imps ms),
text "ms_srcimps =" <+> ppr (ms_srcimps ms)]),
char '}'
]
+pprSummaryTime ms
+ = text "ms_hs_date = " <> parens (text (show (ms_hs_date ms)))
+
+ms_allimps ms
+ = ms_srcimps ms ++ ms_imps ms
+
name_of_summary :: ModSummary -> ModuleName
name_of_summary = moduleName . ms_mod
\end{code}