Copyright | (c) 2013-2016 Galois Inc. |
---|---|
License | BSD3 |
Maintainer | cryptol@galois.com |
Stability | provisional |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Synopsis
- data NameType
- data RenamerInfo = RenamerInfo {}
- newtype RenameM a = RenameM {}
- data RO = RO {}
- data RW = RW {
- rwWarnings :: ![RenamerWarning]
- rwErrors :: !(Seq RenamerError)
- rwSupply :: !Supply
- rwNameUseCount :: !(Map Name Int)
- rwCurrentDeps :: Set Name
- rwDepGraph :: Map DepName (Set Name)
- rwExternalDeps :: !IfaceDecls
- runRenamer :: RenamerInfo -> RenameM a -> (Either [RenamerError] (a, Supply), [RenamerWarning])
- setCurMod :: ModPath -> RenameM a -> RenameM a
- getCurMod :: RenameM ModPath
- getNamingEnv :: RenameM NamingEnv
- setNestedModule :: Map ModPath Name -> RenameM a -> RenameM a
- nestedModuleOrig :: ModPath -> RenameM (Maybe Name)
- record :: RenamerError -> RenameM ()
- collectIfaceDeps :: RenameM a -> RenameM (IfaceDecls, a)
- depsOf :: DepName -> RenameM a -> RenameM a
- depGroup :: RenameM a -> RenameM (a, Map DepName (Set Name))
- curLoc :: RenameM Range
- located :: a -> RenameM (Located a)
- withLoc :: HasLoc loc => loc -> RenameM a -> RenameM a
- shadowNames :: BindsNames env => env -> RenameM a -> RenameM a
- data EnvCheck
- shadowNames' :: BindsNames env => EnvCheck -> env -> RenameM a -> RenameM a
- checkEnv :: EnvCheck -> NamingEnv -> NamingEnv -> RW -> (NamingEnv, RW)
- containsOverlap :: [Name] -> Seq RenamerError
- recordUse :: Name -> RenameM ()
- addDep :: Name -> RenameM ()
- warnUnused :: ModPath -> NamingEnv -> RW -> [RenamerWarning]
- lookupImport :: Import -> RenameM IfaceDecls
Documentation
RW | |
|
runRenamer :: RenamerInfo -> RenameM a -> (Either [RenamerError] (a, Supply), [RenamerWarning]) Source #
record :: RenamerError -> RenameM () Source #
Record an error. XXX: use a better name
collectIfaceDeps :: RenameM a -> RenameM (IfaceDecls, a) Source #
depsOf :: DepName -> RenameM a -> RenameM a Source #
Rename something. All name uses in the sub-computation are assumed to be dependenices of the thing.
depGroup :: RenameM a -> RenameM (a, Map DepName (Set Name)) Source #
This is used when renaming a group of things. The result contains dependencies between names defines and the group, and is intended to be used to order the group members in dependency order.
withLoc :: HasLoc loc => loc -> RenameM a -> RenameM a Source #
Do the given computation using the source code range from loc
if any.
shadowNames :: BindsNames env => env -> RenameM a -> RenameM a Source #
Shadow the current naming environment with some more names.
CheckAll | Check for overlap and shadowing |
CheckOverlap | Only check for overlap |
CheckNone | Don't check the environment |
shadowNames' :: BindsNames env => EnvCheck -> env -> RenameM a -> RenameM a Source #
Shadow the current naming environment with some more names.
checkEnv :: EnvCheck -> NamingEnv -> NamingEnv -> RW -> (NamingEnv, RW) Source #
Generate warnings when the left environment shadows things defined in the right. Additionally, generate errors when two names overlap in the left environment.
containsOverlap :: [Name] -> Seq RenamerError Source #
Check the RHS of a single name rewrite for conflicting sources.
addDep :: Name -> RenameM () Source #
Mark something as a dependency. This is similar but different from
recordUse
, in particular:
* We only record use sites, not bindings
* We record all namespaces, not just types
* We only keep track of actual uses mentioned in the code.
Otoh, recordUse
also considers exported entities to be used.
* If we depend on a name from a sibling submodule we add a dependency on
the module in our common ancestor. Examples:
- A::B::x
depends on A::B::C::D::y
, x
depends on A::B::C
- A::B::x
depends on A::P::Q::y
,
x depends on
A::P@
warnUnused :: ModPath -> NamingEnv -> RW -> [RenamerWarning] Source #
lookupImport :: Import -> RenameM IfaceDecls Source #
Get the exported declarations in a module