mirror of
https://github.com/github/semantic.git
synced 2024-12-19 21:01:35 +03:00
Revert "Don’t specialize null for Exports."
This reverts commit 8f626b6c0f90af595f510543b15400219e5d9102.
This commit is contained in:
parent
676f905468
commit
05999e7559
@ -117,8 +117,8 @@ load name = askModuleTable >>= maybeM notFound . ModuleTable.lookup name >>= run
|
|||||||
-- languages. We need better semantics rather than doing it ad-hoc.
|
-- languages. We need better semantics rather than doing it ad-hoc.
|
||||||
filterEnv :: Exports.Exports l a -> Environment l a -> Environment l a
|
filterEnv :: Exports.Exports l a -> Environment l a -> Environment l a
|
||||||
filterEnv ports env
|
filterEnv ports env
|
||||||
| null ports = env
|
| Exports.null ports = env
|
||||||
| otherwise = Exports.toEnvironment ports `mergeEnvs` overwrite (Exports.aliases ports) env
|
| otherwise = Exports.toEnvironment ports `mergeEnvs` overwrite (Exports.aliases ports) env
|
||||||
|
|
||||||
newtype Merging m location value = Merging { runMerging :: m (Maybe (Environment location value, value)) }
|
newtype Merging m location value = Merging { runMerging :: m (Maybe (Environment location value, value)) }
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ module Data.Abstract.Exports
|
|||||||
( Exports
|
( Exports
|
||||||
, aliases
|
, aliases
|
||||||
, insert
|
, insert
|
||||||
|
, null
|
||||||
, toEnvironment
|
, toEnvironment
|
||||||
) where
|
) where
|
||||||
|
|
||||||
@ -18,6 +19,9 @@ import Data.Semilattice.Lower
|
|||||||
newtype Exports l a = Exports { unExports :: Map.Map Name (Name, Maybe (Address l a)) }
|
newtype Exports l a = Exports { unExports :: Map.Map Name (Name, Maybe (Address l a)) }
|
||||||
deriving (Eq, Foldable, Functor, Generic1, Lower, Monoid, Ord, Semigroup, Show, Traversable)
|
deriving (Eq, Foldable, Functor, Generic1, Lower, Monoid, Ord, Semigroup, Show, Traversable)
|
||||||
|
|
||||||
|
null :: Exports l a -> Bool
|
||||||
|
null = Map.null . unExports
|
||||||
|
|
||||||
toEnvironment :: Exports l a -> Environment l a
|
toEnvironment :: Exports l a -> Environment l a
|
||||||
toEnvironment exports = unpairs (mapMaybe collectExport (toList (unExports exports)))
|
toEnvironment exports = unpairs (mapMaybe collectExport (toList (unExports exports)))
|
||||||
where
|
where
|
||||||
|
Loading…
Reference in New Issue
Block a user