diff options
author | Alan Zimmerman <alan.zimm@gmail.com> | 2016-11-03 14:40:12 +0200 |
---|---|---|
committer | Alan Zimmerman <alan.zimm@gmail.com> | 2016-11-03 20:45:05 +0200 |
commit | f46bfeb8344e1818f42066c3dd9717f49e8b511b (patch) | |
tree | 7f90fe96ae6a66dd364f5d06bc030c4360f00b80 /compiler/backpack | |
parent | ec22bacdd625b04d28228dd5522d59d0bc8b1152 (diff) | |
download | haskell-f46bfeb8344e1818f42066c3dd9717f49e8b511b.tar.gz |
API Annotations: make all ModuleName Located
Summary:
This also changes the backpack Renaming type to use a Maybe for the
renameTo field, to more accurately reflect the parsed source.
Updates haddock submodule to match AST changes
Test Plan: ./validate
Reviewers: ezyang, bgamari, austin
Reviewed By: bgamari
Subscribers: thomie, mpickering
Differential Revision: https://phabricator.haskell.org/D2670
Diffstat (limited to 'compiler/backpack')
-rw-r--r-- | compiler/backpack/BkpSyn.hs | 3 | ||||
-rw-r--r-- | compiler/backpack/DriverBkp.hs | 9 |
2 files changed, 8 insertions, 4 deletions
diff --git a/compiler/backpack/BkpSyn.hs b/compiler/backpack/BkpSyn.hs index ae03324b34..e019d03b24 100644 --- a/compiler/backpack/BkpSyn.hs +++ b/compiler/backpack/BkpSyn.hs @@ -73,5 +73,6 @@ data IncludeDecl n = IncludeDecl { -- | Rename a module from one name to another. The identity renaming -- means that the module should be brought into scope. -data Renaming = Renaming { renameFrom :: ModuleName, renameTo :: ModuleName } +data Renaming = Renaming { renameFrom :: Located ModuleName + , renameTo :: Maybe (Located ModuleName) } type LRenaming = Located Renaming diff --git a/compiler/backpack/DriverBkp.hs b/compiler/backpack/DriverBkp.hs index ccf74c8c9b..cdbe06d51f 100644 --- a/compiler/backpack/DriverBkp.hs +++ b/compiler/backpack/DriverBkp.hs @@ -213,9 +213,12 @@ hsunitDeps :: HsUnit HsComponentId -> [(UnitId, ModRenaming)] hsunitDeps unit = concatMap get_dep (hsunitBody unit) where get_dep (L _ (IncludeD (IncludeDecl (L _ hsuid) mb_lrn))) = [(convertHsUnitId hsuid, go mb_lrn)] - where go Nothing = ModRenaming True [] - go (Just lrns) = ModRenaming False (map convRn lrns) - where convRn (L _ (Renaming from to)) = (from, to) + where + go Nothing = ModRenaming True [] + go (Just lrns) = ModRenaming False (map convRn lrns) + where + convRn (L _ (Renaming (L _ from) Nothing)) = (from, from) + convRn (L _ (Renaming (L _ from) (Just (L _ to)))) = (from, to) get_dep _ = [] buildUnit :: SessionType -> ComponentId -> [(ModuleName, Module)] -> LHsUnit HsComponentId -> BkpM () |