Skip to content

Commit

Permalink
Remove moduleSource
Browse files Browse the repository at this point in the history
Since #62, we no longer need to store source code during analysis.
  • Loading branch information
ocharles committed Apr 30, 2021
1 parent 7ee5fe9 commit 0483d06
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/Weeder.hs
Expand Up @@ -37,9 +37,6 @@ import Data.Monoid ( First( First ) )
import GHC.Generics ( Generic )
import Prelude hiding ( span )

-- bytestring
import Data.ByteString ( ByteString )

-- containers
import Data.Map.Strict ( Map )
import qualified Data.Map.Strict as Map
Expand All @@ -59,7 +56,7 @@ import HieTypes
, DeclType( DataDec, ClassDec, ConDec )
, HieAST( Node, nodeInfo, nodeChildren, nodeSpan )
, HieASTs( HieASTs )
, HieFile( HieFile, hie_asts, hie_exports, hie_module, hie_hs_file, hie_hs_src )
, HieFile( HieFile, hie_asts, hie_exports, hie_module, hie_hs_file )
, IdentifierDetails( IdentifierDetails, identInfo )
, NodeInfo( NodeInfo, nodeIdentifiers, nodeAnnotations )
, Scope( ModuleScope )
Expand Down Expand Up @@ -138,16 +135,14 @@ data Analysis =
-- ^ All exports for a given module.
, modulePaths :: Map Module FilePath
-- ^ A map from modules to the file path to the .hs file defining them.
, moduleSource :: Map Module ByteString
}
deriving
( Generic )


-- | The empty analysis - the result of analysing zero @.hie@ files.
emptyAnalysis :: Analysis
emptyAnalysis =
Analysis empty mempty mempty mempty mempty mempty
emptyAnalysis = Analysis empty mempty mempty mempty mempty


-- | A root for reachability analysis.
Expand Down Expand Up @@ -180,9 +175,8 @@ allDeclarations Analysis{ dependencyGraph } =

-- | Incrementally update 'Analysis' with information in a 'HieFile'.
analyseHieFile :: MonadState Analysis m => HieFile -> m ()
analyseHieFile HieFile{ hie_asts = HieASTs hieASTs, hie_exports, hie_module, hie_hs_file, hie_hs_src } = do
analyseHieFile HieFile{ hie_asts = HieASTs hieASTs, hie_exports, hie_module, hie_hs_file } = do
#modulePaths %= Map.insert hie_module hie_hs_file
#moduleSource %= Map.insert hie_module hie_hs_src

for_ hieASTs \ast -> do
addAllDeclarations ast
Expand Down

0 comments on commit 0483d06

Please sign in to comment.