diff options
-rw-r--r-- | compiler/GHC/Driver/Backpack.hs | 22 | ||||
-rw-r--r-- | compiler/GHC/Driver/Backpack/Syntax.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/Parser.y | 10 |
3 files changed, 7 insertions, 27 deletions
diff --git a/compiler/GHC/Driver/Backpack.hs b/compiler/GHC/Driver/Backpack.hs index 852ff4c0f2..1da05dbda8 100644 --- a/compiler/GHC/Driver/Backpack.hs +++ b/compiler/GHC/Driver/Backpack.hs @@ -719,8 +719,8 @@ hsunitModuleGraph unit = do -- 1. Create a HsSrcFile/HsigFile summary for every -- explicitly mentioned module/signature. - let get_decl (L _ (DeclD hsc_src lmodname mb_hsmod)) = - Just `fmap` summariseDecl pn hsc_src lmodname mb_hsmod + let get_decl (L _ (DeclD hsc_src lmodname hsmod)) = + Just `fmap` summariseDecl pn hsc_src lmodname hsmod get_decl _ = return Nothing nodes <- catMaybes `fmap` mapM get_decl decls @@ -806,23 +806,9 @@ summariseRequirement pn mod_name = do summariseDecl :: PackageName -> HscSource -> Located ModuleName - -> Maybe (Located HsModule) + -> Located HsModule -> BkpM ExtendedModSummary -summariseDecl pn hsc_src (L _ modname) (Just hsmod) = hsModuleToModSummary pn hsc_src modname hsmod -summariseDecl _pn hsc_src lmodname@(L loc modname) Nothing - = do hsc_env <- getSession - -- TODO: this looks for modules in the wrong place - r <- liftIO $ summariseModule hsc_env - emptyModNodeMap -- GHC API recomp not supported - (hscSourceToIsBoot hsc_src) - lmodname - Nothing -- GHC API buffer support not supported - [] -- No exclusions - case r of - Nothing -> throwOneError $ fmap GhcDriverMessage - $ mkPlainErrorMsgEnvelope loc (DriverBackpackModuleNotFound modname) - Just (Left err) -> throwErrors (fmap GhcDriverMessage err) - Just (Right summary) -> return summary +summariseDecl pn hsc_src (L _ modname) hsmod = hsModuleToModSummary pn hsc_src modname hsmod -- | Up until now, GHC has assumed a single compilation target per source file. -- Backpack files with inline modules break this model, since a single file diff --git a/compiler/GHC/Driver/Backpack/Syntax.hs b/compiler/GHC/Driver/Backpack/Syntax.hs index a0529fce2e..e67c62d6d8 100644 --- a/compiler/GHC/Driver/Backpack/Syntax.hs +++ b/compiler/GHC/Driver/Backpack/Syntax.hs @@ -65,7 +65,7 @@ type LHsUnit n = Located (HsUnit n) -- | A declaration in a package, e.g. a module or signature definition, -- or an include. data HsUnitDecl n - = DeclD HscSource (Located ModuleName) (Maybe (Located HsModule)) + = DeclD HscSource (Located ModuleName) (Located HsModule) | IncludeD (IncludeDecl n) type LHsUnitDecl n = Located (HsUnitDecl n) diff --git a/compiler/GHC/Parser.y b/compiler/GHC/Parser.y index 075f7bff00..9dcf96551e 100644 --- a/compiler/GHC/Parser.y +++ b/compiler/GHC/Parser.y @@ -852,18 +852,12 @@ unitdecl :: { LHsUnitDecl PackageName } NotBoot -> HsSrcFile IsBoot -> HsBootFile) (reLoc $3) - (Just $ sL1 $1 (HsModule noAnn (thdOf3 $7) (Just $3) $5 (fst $ sndOf3 $7) (snd $ sndOf3 $7) $4 Nothing)) } + (sL1 $1 (HsModule noAnn (thdOf3 $7) (Just $3) $5 (fst $ sndOf3 $7) (snd $ sndOf3 $7) $4 Nothing)) } | 'signature' modid maybemodwarning maybeexports 'where' body { sL1 $1 $ DeclD HsigFile (reLoc $2) - (Just $ sL1 $1 (HsModule noAnn (thdOf3 $6) (Just $2) $4 (fst $ sndOf3 $6) (snd $ sndOf3 $6) $3 Nothing)) } - | 'module' maybe_src modid - { sL1 $1 $ DeclD (case snd $2 of - NotBoot -> HsSrcFile - IsBoot -> HsBootFile) (reLoc $3) Nothing } - | 'signature' modid - { sL1 $1 $ DeclD HsigFile (reLoc $2) Nothing } + (sL1 $1 (HsModule noAnn (thdOf3 $6) (Just $2) $4 (fst $ sndOf3 $6) (snd $ sndOf3 $6) $3 Nothing)) } | 'dependency' unitid mayberns { sL1 $1 $ IncludeD (IncludeDecl { idUnitId = $2 , idModRenaming = $3 |