summaryrefslogtreecommitdiff
path: root/src/GF/Compile/BackOpt.hs
diff options
context:
space:
mode:
authorkrasimir <krasimir@chalmers.se>2009-11-07 15:18:25 +0000
committerkrasimir <krasimir@chalmers.se>2009-11-07 15:18:25 +0000
commit7c513609f03c5719e0a15c61b7d44abc8d6b56d6 (patch)
tree0ec34ce080dbe305e5ac253e0d87073b74c5ac40 /src/GF/Compile/BackOpt.hs
parentea49556395d854401344a622ea91c8a948dfc8b8 (diff)
bugfix: if a concrete module has operations then they also should be optimized
Diffstat (limited to 'src/GF/Compile/BackOpt.hs')
-rw-r--r--src/GF/Compile/BackOpt.hs10
1 files changed, 6 insertions, 4 deletions
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