diff options
| author | kr.angelov <kr.angelov@gmail.com> | 2011-11-15 13:33:44 +0000 |
|---|---|---|
| committer | kr.angelov <kr.angelov@gmail.com> | 2011-11-15 13:33:44 +0000 |
| commit | 61c16f2eb2a042152a2b04f709d0cefe6e5a14df (patch) | |
| tree | 04fad20bcc0923f4a505a87a2ec9ef139394d868 /src/compiler/GF/Compile.hs | |
| parent | 8a7aa15c5717e3ab4ebe0e63459759be4863e07e (diff) | |
more structured format for errors and warnings from the compiler
Diffstat (limited to 'src/compiler/GF/Compile.hs')
| -rw-r--r-- | src/compiler/GF/Compile.hs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/compiler/GF/Compile.hs b/src/compiler/GF/Compile.hs index aac2a0fb7..e4fe85aef 100644 --- a/src/compiler/GF/Compile.hs +++ b/src/compiler/GF/Compile.hs @@ -82,6 +82,13 @@ intermOut opts d doc | dump opts d = ioeIO (hPutStrLn stderr (render (text "\n\n--#" <+> text (show d) $$ doc))) | otherwise = return () +warnOut opts warnings + | null warnings = return () + | otherwise = ioeIO (hPutStrLn stderr $ + if flag optVerbosity opts == Normal + then ('\n':warnings) + else warnings) + -- | the environment type CompileEnv = (Int,SourceGrammar,ModEnv) @@ -173,8 +180,7 @@ compileOne opts env@(_,srcgr,_) file = do compileSourceModule :: Options -> CompileEnv -> Maybe FilePath -> SourceModule -> IOE CompileEnv compileSourceModule opts env@(k,gr,_) mb_gfFile mo@(i,mi) = do - let puts = putPointE Quiet opts - putpp = putPointE Verbose opts + let putpp = putPointE Verbose opts mo1 <- ioeErr $ rebuildModule gr mo intermOut opts DumpRebuild (ppModule Qualified mo1) @@ -198,11 +204,11 @@ compileSourceModule opts env@(k,gr,_) mb_gfFile mo@(i,mi) = do let mos = modules gr (mo2,warnings) <- putpp " renaming " $ ioeErr $ runCheck (renameModule mos mo1b) - if null warnings then return () else puts warnings $ return () + warnOut opts warnings intermOut opts DumpRename (ppModule Qualified mo2) (mo3,warnings) <- putpp " type checking" $ ioeErr $ runCheck (checkModule mos mo2) - if null warnings then return () else puts warnings $ return () + warnOut opts warnings intermOut opts DumpTypeCheck (ppModule Qualified mo3) if not (flag optTagsOnly opts) |
