on master help sign in
Remove 'Crash' from AST.Expression.General
commit92dc0574f2456ae96363b44d56fc88e2795936e8 authorEvan Czaplicki <info@elm-lang.org> dateFri 4 Sep 2015, 02:22 (11 years ago) parent159db7c
9 files changed−74
elm-compiler.cabal−2 src/AST/Expression/General.hs−5 src/Canonicalize.hs−3 src/Canonicalize/Sort.hs−3 src/Generate/JavaScript/Crash.hs−32 src/Nitpick/PatternMatches.hs−3 src/Reporting/Crash.hs−20 src/Type/Constrain/Expression.hs−3 src/Validate.hs−3
elm-compiler.cabal−2
@@ -78,7 +78,6 @@ Library
7878 Elm.Compiler.Version,
7979 Generate.JavaScript,
8080 Generate.JavaScript.BuiltIn,
81− Generate.JavaScript.Crash,
8281 Generate.JavaScript.Helpers,
8382 Generate.JavaScript.Literal,
8483 Generate.JavaScript.Port,
@@ -100,7 +99,6 @@ Library
10099 Parse.Pattern,
101100 Parse.Type,
102101 Reporting.Annotation,
103− Reporting.Crash,
104102 Reporting.Error,
105103 Reporting.Error.Canonicalize,
106104 Reporting.Error.Docs,
src/AST/Expression/General.hs−5
@@ -16,7 +16,6 @@ import qualified AST.Pattern as Pattern
1616import qualified AST.Type as Type
1717import qualified AST.Variable as Var
1818import qualified Reporting.Annotation as A
19−import qualified Reporting.Crash as Crash
2019import qualified Reporting.PrettyPrint as P
2120
2221
@@ -59,7 +58,6 @@ data Expr' ann def var typ
5958 -- for type checking and code gen only
6059 | Port (PortImpl (Expr ann def var typ) typ)
6160 | GLShader String String Literal.GLShaderTipe
62− | Crash Crash.Details
6361 deriving (Show)
6462
6563
@@ -249,9 +247,6 @@ instance (P.Pretty def, P.Pretty var, Var.ToString var) => P.Pretty (Expr' ann d
249247 Port portImpl ->
250248 P.pretty dealiaser needsParens portImpl
251249
252− Crash details ->
253− P.text ("<crash:" ++ Crash.summary details ++ ">")
254−
255250
256251instance P.Pretty (PortImpl expr tipe) where
257252 pretty _ _ impl =
src/Canonicalize.hs−3
@@ -487,9 +487,6 @@ expression env (A.A region validExpr) =
487487 GLShader uid src tipe ->
488488 Result.ok (GLShader uid src tipe)
489489
490− Crash details ->
491− Result.ok (Crash details)
492−
493490
494491pattern
495492 :: Env.Environment
src/Canonicalize/Sort.hs−3
@@ -108,9 +108,6 @@ reorder (A.A ann expression) =
108108 Task name expr tipe ->
109109 (\e -> Task name e tipe) <$> reorder expr
110110
111− Crash _ ->
112− return expression
113−
114111 -- Actually do some reordering
115112 Let defs body ->
116113 do body' <- reorder body
src/Generate/JavaScript/Crash.hsdeleted−32
@@ -1,32 +0,0 @@
1−module Generate.JavaScript.Crash where
2−
3−import Language.ECMAScript3.Syntax (Expression)
4−
5−import Generate.JavaScript.Helpers (call, obj, ref, string)
6−import qualified Reporting.Crash as Crash
7−import qualified Reporting.Region as R
8−
9−
10−localModuleName :: String
11−localModuleName =
12− "$moduleName"
13−
14−
15−crash :: Crash.Details -> Expression ()
16−crash details =
17− case details of
18− Crash.IncompleteMultiIf region ->
19− obj ["_U","badIf"]
20− `call`
21− [ ref localModuleName
22− , string (R.toString region)
23− ]
24−
25− Crash.IncompletePatternMatch _region ->
26− obj ["_U","badCase"]
27− `call`
28− [ ref localModuleName
29− , string "bugs in reporting the exact location right now" -- TODO
30− ]
31−
32−
src/Nitpick/PatternMatches.hs−3
@@ -181,9 +181,6 @@ checkExpression tagDict (A.A region expression) =
181181 E.GLShader _ _ _ ->
182182 Result.ok ()
183183
184− E.Crash _ ->
185− Result.ok ()
186−
187184
188185-- CHECK PATTERNS
189186
src/Reporting/Crash.hsdeleted−20
@@ -1,20 +0,0 @@
1−{-# OPTIONS_GHC -Wall #-}
2−module Reporting.Crash where
3−
4−import qualified Reporting.Region as R
5−
6−
7−data Details
8− = IncompleteMultiIf R.Region
9− | IncompletePatternMatch R.Region
10− deriving (Show)
11−
12−
13−summary :: Details -> String
14−summary details =
15− case details of
16− IncompleteMultiIf _ ->
17− "incomplete-multi-if"
18−
19− IncompletePatternMatch _ ->
20− "incomplete-pattern-match"
src/Type/Constrain/Expression.hs−3
@@ -168,9 +168,6 @@ constrain env annotatedExpr@(A.A region expression) tipe =
168168 E.Task _ expr _ ->
169169 constrain env expr tipe
170170
171− E.Crash _ ->
172− return CTrue
173−
174171
175172-- CONSTRAIN APP
176173
src/Validate.hs−3
@@ -254,9 +254,6 @@ expression (A.A ann sourceExpression) =
254254 do expr' <- expression expr
255255 return (Task name expr' tipe)
256256
257− Crash details ->
258− return (Crash details)
259−
260257
261258second :: (a, Source.Expr) -> Result.Result wrn Error.Error (a, Valid.Expr)
262259second (value, expr) =