mirror of
https://github.com/GaloisInc/cryptol.git
synced 2024-11-11 08:37:35 +03:00
Restrict PrimMap to only refer to actual primtives.
Previously it would contain everything in the prelude. Mostly this was not a problem because the usual use case for this is to find out the names of actual primitives, so having more in the mapping is not a problem. However, this accuracy is inconveninet, if you want to quickly look what's actually a primitive
This commit is contained in:
parent
64d58002f4
commit
31da6cb366
@ -173,6 +173,7 @@ instance Monoid IfaceDecls where
|
||||
data IfaceDecl = IfaceDecl
|
||||
{ ifDeclName :: !Name -- ^ Name of thing
|
||||
, ifDeclSig :: Schema -- ^ Type
|
||||
, ifDeclIsPrim :: !Bool
|
||||
, ifDeclPragmas :: [Pragma] -- ^ Pragmas
|
||||
, ifDeclInfix :: Bool -- ^ Is this an infix thing
|
||||
, ifDeclFixity :: Maybe Fixity -- ^ Fixity information
|
||||
@ -188,8 +189,8 @@ ifacePrimMap = ifaceDeclsPrimMap . ifDefines
|
||||
|
||||
ifaceDeclsPrimMap :: IfaceDecls -> PrimMap
|
||||
ifaceDeclsPrimMap IfaceDecls { .. } =
|
||||
PrimMap { primDecls = Map.fromList (newtypes ++ exprs)
|
||||
, primTypes = Map.fromList (newtypes ++ types)
|
||||
PrimMap { primDecls = Map.fromList exprs
|
||||
, primTypes = Map.fromList types
|
||||
}
|
||||
where
|
||||
entry n = case asPrim n of
|
||||
@ -199,6 +200,7 @@ ifaceDeclsPrimMap IfaceDecls { .. } =
|
||||
[ "Top level name not declared in a module?"
|
||||
, show n ]
|
||||
|
||||
exprs = map entry (Map.keys ifDecls)
|
||||
newtypes = map entry (Map.keys ifNewtypes)
|
||||
types = map entry (Map.keys ifTySyns)
|
||||
exprs = [ entry x | (x,d) <- Map.toList ifDecls, ifDeclIsPrim d ]
|
||||
types = map entry (Map.keys ifAbstractTypes)
|
||||
|
||||
|
||||
|
@ -16,6 +16,9 @@ mkIfaceDecl :: Decl -> IfaceDecl
|
||||
mkIfaceDecl d = IfaceDecl
|
||||
{ ifDeclName = dName d
|
||||
, ifDeclSig = dSignature d
|
||||
, ifDeclIsPrim = case dDefinition d of
|
||||
DPrim {} -> True
|
||||
_ -> False
|
||||
, ifDeclPragmas = dPragmas d
|
||||
, ifDeclInfix = dInfix d
|
||||
, ifDeclFixity = dFixity d
|
||||
|
Loading…
Reference in New Issue
Block a user