mirror of
https://github.com/github/semantic.git
synced 2024-12-24 23:42:31 +03:00
Store Name and Span in Located
This commit is contained in:
parent
89ca32661e
commit
c9502add3f
@ -34,11 +34,11 @@ instance Member NonDet effects => Addressable Monovariant effects where
|
||||
derefCell _ = traverse (foldMapA pure) . nonEmpty . toList
|
||||
|
||||
-- | 'Located' addresses allocate & dereference using the underlying address, contextualizing addresses with the current 'PackageInfo' & 'ModuleInfo'.
|
||||
instance (Addressable address effects, Member (Reader ModuleInfo) effects, Member (Reader PackageInfo) effects) => Addressable (Located address) effects where
|
||||
instance (Addressable address effects, Member (Reader ModuleInfo) effects, Member (Reader PackageInfo) effects, Member (Reader Span) effects) => Addressable (Located address) effects where
|
||||
type Cell (Located address) = Cell address
|
||||
|
||||
allocCell name = relocate (Located <$> allocCell name <*> currentPackage <*> currentModule)
|
||||
derefCell (Located loc _ _) = relocate . derefCell loc
|
||||
allocCell name = relocate (Located <$> allocCell name <*> currentPackage <*> currentModule <*> pure name <*> ask)
|
||||
derefCell (Located loc _ _ _ _) = relocate . derefCell loc
|
||||
|
||||
instance (Addressable address effects, Ord context, Show context) => Addressable (Hole context address) effects where
|
||||
type Cell (Hole context address) = Cell address
|
||||
|
@ -12,6 +12,7 @@ import Data.Abstract.Name
|
||||
import Data.Abstract.Package (PackageInfo)
|
||||
import Data.Monoid (Last(..))
|
||||
import Data.Semigroup.Reducer
|
||||
import Data.Span
|
||||
import Data.Set as Set
|
||||
import Prologue
|
||||
|
||||
@ -35,6 +36,8 @@ data Located address = Located
|
||||
{ address :: address
|
||||
, addressPackage :: {-# UNPACK #-} !PackageInfo
|
||||
, addressModule :: !ModuleInfo
|
||||
, addressName :: Name
|
||||
, addressSpan :: Span
|
||||
}
|
||||
deriving (Eq, Ord, Show)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user