From 713e883ad7816f0bb0e3cb7f3cb8fc2a636c805b Mon Sep 17 00:00:00 2001 From: hallgren Date: Mon, 28 Jan 2013 16:12:56 +0000 Subject: Better error message for Predef.error + Instead of "Internal error in ...", you now get a proper error message with a source location and a function name. + Also added some missing error value propagation in the partial evaluator. + Also some other minor cleanup and error handling fixes. --- src/compiler/GF/Compile.hs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/compiler/GF/Compile.hs') diff --git a/src/compiler/GF/Compile.hs b/src/compiler/GF/Compile.hs index b8db1e1a9..9b71c0f39 100644 --- a/src/compiler/GF/Compile.hs +++ b/src/compiler/GF/Compile.hs @@ -30,7 +30,7 @@ import System.IO import System.Directory import System.FilePath import qualified Data.Map as Map -import qualified Data.Set as Set +--import qualified Data.Set as Set import Data.List(nub) import Data.Maybe (isNothing) import qualified Data.ByteString.Char8 as BS @@ -55,7 +55,7 @@ link opts cnc gr = do let isv = (verbAtLeast opts Normal) putPointE Normal opts "linking ... " $ do let abs = err (const cnc) id $ abstractOfConcrete gr cnc - pgf <- ioeIO (mkCanon2pgf opts gr abs) + pgf <- mkCanon2pgf opts gr abs probs <- ioeIO (maybe (return . defaultProbabilities) readProbabilitiesFromFile (flag optProbsFile opts) pgf) ioeIO $ when (verbAtLeast opts Normal) $ putStrFlush "OK" return $ setProbabilities probs @@ -196,7 +196,7 @@ compileSourceModule opts env@(k,gr,_) mb_gfFile mo@(i,mi) = do refreshModule (k,gr) mo3 mo4 <- runPass2 id Optimize "optimizing" $ optimizeModule opts gr mo3r mo5 <- if isModCnc (snd mo4) && flag optPMCFG opts - then runPass2' "generating PMCFG" $ generatePMCFG opts gr mo4 + then runPass2' "generating PMCFG" $ generatePMCFG opts gr mb_gfFile mo4 else runPass2' "" $ return mo4 generateGFO k' mo5 @@ -215,9 +215,10 @@ compileSourceModule opts env@(k,gr,_) mb_gfFile mo@(i,mi) = do putpp s = if null s then id else putPointE Verbose opts (" "++s++" ") idump pass = intermOut opts (Dump pass) . ppModule Internal + -- * Impedance matching runPass = runPass' fst fst snd (ioeErr . runCheck) runPass2 = runPass2e ioeErr - runPass2' = runPass2e ioeIO id Canon + runPass2' = runPass2e id id Canon runPass2e lift f = runPass' id f (const "") lift runPass' ret dump warn lift pass pp m = -- cgit v1.2.3