Changed some instances of lookupName to lookupNameOrError to make it a little easier to track down internal compiler errors

This commit is contained in:
Neil Brown 2007-08-28 15:28:52 +00:00
parent c09da951f0
commit 15be4ddca9
2 changed files with 3 additions and 3 deletions

View File

@ -37,11 +37,11 @@ import Metadata
specTypeOfName :: (CSM m, Die m) => A.Name -> m A.SpecType
specTypeOfName n
= liftM A.ndType (lookupName n)
= liftM A.ndType (lookupNameOrError n $ dieP (A.nameMeta n) $ "Could not find find type in specTypeOfName for: " ++ (show $ A.nameName n))
abbrevModeOfName :: (CSM m, Die m) => A.Name -> m A.AbbrevMode
abbrevModeOfName n
= liftM A.ndAbbrevMode (lookupName n)
= liftM A.ndAbbrevMode (lookupNameOrError n $ dieP (A.nameMeta n) $ "Could not find find abbreviation mode in abbrevModeOfName for: " ++ (show $ A.nameName n))
typeOfName :: (CSM m, Die m) => A.Name -> m A.Type
typeOfName n

View File

@ -134,7 +134,7 @@ removeFreeNames = doGeneric `extM` doSpecification `extM` doProcess
-- Generate and define new names to replace them with
newNamesS <- sequence [makeNonce (A.nameName n) | n <- freeNames]
let newNames = [on { A.nameName = nn } | (on, nn) <- zip freeNames newNamesS]
onds <- mapM lookupName freeNames
onds <- mapM (\n -> lookupNameOrError n $ dieP mp $ "Could not find recorded type for free name: " ++ (show $ A.nameName n)) freeNames
sequence_ [defineName nn (ond { A.ndName = A.nameName nn,
A.ndAbbrevMode = am })
| (ond, nn, am) <- zip3 onds newNames ams]