1
1
mirror of https://github.com/github/semantic.git synced 2024-12-30 10:27:45 +03:00
This commit is contained in:
Timothy Clem 2018-03-07 08:34:52 -08:00
parent 5f5aa907cb
commit 841cd2e323

View File

@ -208,6 +208,7 @@ instance Show1 Comprehension where liftShowsPrec = genericLiftShowsPrec
-- TODO: Implement Eval instance for Comprehension
instance Evaluatable Comprehension
-- | Qualified Import declarations (symbols are qualified in calling environment).
data QualifiedImport a = QualifiedImport { qualifiedImportFrom :: !a, qualifiedImportAlias :: !a, qualifiedImportSymbols :: ![(Name, Name)]}
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable, FreeVariables1)
@ -231,6 +232,7 @@ instance Evaluatable QualifiedImport where
qualifyInsert k v rest = envInsert (prefix <> k) v <$> rest
directInsert k v rest = maybe rest (\symAlias -> envInsert symAlias v <$> rest) (Map.lookup k symbols)
-- | Import declarations (symbols are added directly to the calling env).
--
-- If symbols is empty, just evaluate the module for it's side effects.
@ -253,6 +255,7 @@ instance Evaluatable Import where
symbols = Map.fromList xs
directInsert k v rest = maybe rest (\symAlias -> envInsert symAlias v <$> rest) (Map.lookup k symbols)
-- | A wildcard import (all symbols are added directly to the calling env)
--
-- Import a module updating the importing environments.