From 7c513609f03c5719e0a15c61b7d44abc8d6b56d6 Mon Sep 17 00:00:00 2001 From: krasimir Date: Sat, 7 Nov 2009 15:18:25 +0000 Subject: bugfix: if a concrete module has operations then they also should be optimized --- src/GF/Compile/BackOpt.hs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/GF/Compile/BackOpt.hs') diff --git a/src/GF/Compile/BackOpt.hs b/src/GF/Compile/BackOpt.hs index 089a192d5..70dbcc9ba 100644 --- a/src/GF/Compile/BackOpt.hs +++ b/src/GF/Compile/BackOpt.hs @@ -15,7 +15,7 @@ -- following advice of Josef Svenningsson ----------------------------------------------------------------------------- -module GF.Compile.BackOpt (shareModule, OptSpec) where +module GF.Compile.BackOpt (shareModule) where import GF.Grammar.Grammar import GF.Infra.Ident @@ -29,10 +29,12 @@ import qualified Data.ByteString.Char8 as BS import Data.Set (Set) import qualified Data.Set as Set -type OptSpec = Set Optimization +shareModule :: Options -> SourceModule -> SourceModule +shareModule opts (i,mo) = (i,M.replaceJudgements mo (mapTree (shareInfo optim) (M.jments mo))) + where + optim = flag optOptimizations opts -shareModule :: OptSpec -> SourceModule -> SourceModule -shareModule opt (i,mo) = (i,M.replaceJudgements mo (mapTree (shareInfo opt) (M.jments mo))) +type OptSpec = Set Optimization shareInfo :: OptSpec -> (Ident, Info) -> Info shareInfo opt (c, CncCat ty (Just t) m) = CncCat ty (Just (shareOptim opt c t)) m -- cgit v1.2.3