Consistenly use SourceGrammar instead of [SourceModule] when calling compiler passes

This commit is contained in:
hallgren
2012-10-19 19:56:00 +00:00
parent 921b37834c
commit 1195db1da3
6 changed files with 34 additions and 34 deletions

View File

@@ -106,15 +106,15 @@ refreshEquation pst = err Bad (return . fst) (appSTM (refr pst) initIdState) whe
-- for concrete and resource in grammar, before optimizing
refreshGrammar :: SourceGrammar -> Err SourceGrammar
refreshGrammar = liftM (mGrammar . snd) . foldM refreshModule (0,[]) . modules
--refreshGrammar :: SourceGrammar -> Err SourceGrammar
--refreshGrammar = liftM (mGrammar . snd) . foldM refreshModule (0,[]) . modules
refreshModule :: (Int,[SourceModule]) -> SourceModule -> Err (Int,[SourceModule])
refreshModule (k,ms) mi@(i,mo)
refreshModule :: (Int,SourceGrammar) -> SourceModule -> Err (Int,[SourceModule])
refreshModule (k,sgr) mi@(i,mo)
| isModCnc mo || isModRes mo = do
(k',js') <- foldM refreshRes (k,[]) $ tree2list $ jments mo
return (k', (i,mo{jments=buildTree js'}) : ms)
| otherwise = return (k, mi:ms)
return (k', (i,mo{jments=buildTree js'}) : modules sgr)
| otherwise = return (k, mi:modules sgr)
where
refreshRes (k,cs) ci@(c,info) = case info of
ResOper ptyp (Just (L loc trm)) -> do ---- refresh ptyp