1
1
mirror of https://github.com/github/semantic.git synced 2024-12-27 00:44:57 +03:00

Move the address types into their own modules.

This commit is contained in:
Rob Rix 2018-08-10 13:44:04 -04:00
parent 53a9ca30aa
commit b93c15370e
4 changed files with 45 additions and 33 deletions

View File

@ -4,33 +4,6 @@ module Data.Abstract.Address
, Monovariant (..)
) where
import Data.Abstract.Module (ModuleInfo)
import Data.Abstract.Name
import Data.Abstract.Package (PackageInfo)
import Data.Span
import Prologue
-- | 'Precise' models precise store semantics where only the 'Latest' value is taken. Everything gets it's own address (always makes a new allocation) which makes for a larger store.
newtype Precise = Precise { unPrecise :: Int }
deriving (Eq, Ord)
instance Show Precise where
showsPrec d = showsUnaryWith showsPrec "Precise" d . unPrecise
-- | 'Monovariant' models using one address for a particular name. It trackes the set of values that a particular address takes and uses it's name to lookup in the store and only allocation if new.
newtype Monovariant = Monovariant { unMonovariant :: Name }
deriving (Eq, Ord)
instance Show Monovariant where
showsPrec d = showsUnaryWith showsPrec "Monovariant" d . unMonovariant
data Located address = Located
{ address :: address
, addressPackage :: {-# UNPACK #-} !PackageInfo
, addressModule :: !ModuleInfo
, addressName :: Name
, addressSpan :: Span
}
deriving (Eq, Ord, Show)
import Data.Abstract.Address.Located
import Data.Abstract.Address.Monovariant
import Data.Abstract.Address.Precise

View File

@ -1 +1,17 @@
module Data.Abstract.Address.Located where
module Data.Abstract.Address.Located
( Located(..)
) where
import Data.Abstract.Module (ModuleInfo)
import Data.Abstract.Name
import Data.Abstract.Package (PackageInfo)
import Data.Span
data Located address = Located
{ address :: address
, addressPackage :: {-# UNPACK #-} !PackageInfo
, addressModule :: !ModuleInfo
, addressName :: Name
, addressSpan :: Span
}
deriving (Eq, Ord, Show)

View File

@ -1 +1,13 @@
module Data.Abstract.Address.Monovariant where
module Data.Abstract.Address.Monovariant
( Monovariant(..)
) where
import Data.Abstract.Name
import Prologue
-- | 'Monovariant' models using one address for a particular name. It trackes the set of values that a particular address takes and uses it's name to lookup in the store and only allocation if new.
newtype Monovariant = Monovariant { unMonovariant :: Name }
deriving (Eq, Ord)
instance Show Monovariant where
showsPrec d = showsUnaryWith showsPrec "Monovariant" d . unMonovariant

View File

@ -1 +1,12 @@
module Data.Abstract.Address.Precise where
module Data.Abstract.Address.Precise
( Precise(..)
) where
import Prologue
-- | 'Precise' models precise store semantics where only the 'Latest' value is taken. Everything gets it's own address (always makes a new allocation) which makes for a larger store.
newtype Precise = Precise { unPrecise :: Int }
deriving (Eq, Ord)
instance Show Precise where
showsPrec d = showsUnaryWith showsPrec "Precise" d . unPrecise