on master help sign in
Shuffle APIs to send compile errors through to command line
commit01a0b06fa0301670b3e979c8442fe196fb49e951 authorEvan Czaplicki <evancz@users.noreply.github.com> dateMon 6 May 2019, 13:49 (7 years ago) parent7324fca
2 files changed+10−15
builder/src/Reporting/Exit/Help.hs+5−5 compiler/src/Reporting/Error.hs+5−10
builder/src/Reporting/Exit/Help.hs+5−5
@@ -22,7 +22,7 @@ import qualified Json.Encode as E
2222import Json.Encode ((==>))
2323import Reporting.Doc ((<+>))
2424import qualified Reporting.Doc as D
25−import qualified Reporting.Exit.Compile as Compile
25+import qualified Reporting.Error as Error
2626
2727
2828
@@ -30,7 +30,7 @@ import qualified Reporting.Exit.Compile as Compile
3030
3131
3232data Report
33− = CompilerReport Compile.Exit [Compile.Exit]
33+ = CompilerReport Error.Module [Error.Module]
3434 | Report
3535 { _title :: String
3636 , _path :: Maybe FilePath
@@ -53,7 +53,7 @@ jsonReport =
5353 Report
5454
5555
56−compilerReport :: Compile.Exit -> [Compile.Exit] -> Report
56+compilerReport :: Error.Module -> [Error.Module] -> Report
5757compilerReport =
5858 CompilerReport
5959
@@ -66,7 +66,7 @@ reportToDoc :: Report -> D.Doc
6666reportToDoc report_ =
6767 case report_ of
6868 CompilerReport e es ->
69− Compile.toDoc e es
69+ Error.toDoc e es
7070
7171 Report title maybePath message ->
7272 let
@@ -98,7 +98,7 @@ reportToJson report_ =
9898 CompilerReport e es ->
9999 E.object
100100 [ "type" ==> E.string "compile-errors"
101− , "errors" ==> E.list Compile.toJson (e:es)
101+ , "errors" ==> E.list Error.toJson (e:es)
102102 ]
103103
104104 Report title maybePath message ->
compiler/src/Reporting/Error.hs+5−10
@@ -89,11 +89,11 @@ toReports source err =
8989-- TO DOC
9090
9191
92−toDoc :: NE.List Module -> D.Doc
93−toDoc modules =
92+toDoc :: Module -> [Module] -> D.Doc
93+toDoc err errs =
9494 let
9595 timeCompare m1 m2 = compare (_time m1) (_time m2)
96− (NE.List m ms) = NE.sortBy timeCompare modules
96+ (NE.List m ms) = NE.sortBy timeCompare (NE.List err errs)
9797 in
9898 D.vcat (toDocHelp m ms)
9999
@@ -164,13 +164,8 @@ toMessageBar title filePath =
164164-- TO JSON
165165
166166
167−toJson :: NE.List Module -> E.Value
168−toJson modules =
169− E.array (map moduleToJson (NE.toList modules))
170−
171−
172−moduleToJson :: Module -> E.Value
173−moduleToJson (Module name path _ source err) =
167+toJson :: Module -> E.Value
168+toJson (Module name path _ source err) =
174169 let
175170 reports =
176171 toReports (Code.toSource source) err