on master help sign in
Stop tracking docs in AST.Canonical, and model Float and Shader a bit different
commit82ebd8c54e48d40fa56393405f12d5404e38a791 authorEvan Czaplicki <evancz@users.noreply.github.com> dateThu 27 Dec 2018, 11:45 (8 years ago) parent8f4bd0d
1 file changed+10−28
compiler/src/AST/Canonical.hs+10−28
compiler/src/AST/Canonical.hs+10−28
@@ -23,7 +23,6 @@ module AST.Canonical
2323 , Binop(..)
2424 , Union(..)
2525 , Ctor(..)
26− , Docs(..)
2726 , Exports(..)
2827 , Export(..)
2928 , Effects(..)
@@ -54,19 +53,16 @@ So it is clear why the data is kept around.
5453
5554import Control.Monad (liftM, liftM2, liftM3, liftM4, replicateM)
5655import Data.Binary
57−import qualified Data.ByteString as B
5856import qualified Data.List as List
5957import qualified Data.Map as Map
6058import Data.Name (Name)
61−import Data.Text (Text)
62−import Data.Utf8 (Utf8)
59+import qualified Data.Utf8 as Utf8
6360
6461import qualified AST.Utils.Binop as Binop
6562import qualified AST.Utils.Shader as Shader
6663import qualified Data.Index as Index
6764import qualified Elm.ModuleName as ModuleName
6865import qualified Reporting.Annotation as A
69−import qualified Reporting.Region as R
7066
7167
7268
@@ -86,10 +82,10 @@ data Expr_
8682 | VarCtor CtorOpts ModuleName.Canonical Name Index.ZeroBased Annotation
8783 | VarDebug ModuleName.Canonical Name Annotation
8884 | VarOperator Name ModuleName.Canonical Name Annotation -- CACHE real name for optimization
89− | Chr Utf8
90− | Str Utf8
85+ | Chr Utf8.String
86+ | Str Utf8.String
9187 | Int Int
92− | Float Double
88+ | Float (Utf8.Under256 Float)
9389 | List [Expr]
9490 | Negate Expr
9591 | Binop Name ModuleName.Canonical Name Annotation Expr Expr -- CACHE real name for optimization
@@ -106,7 +102,7 @@ data Expr_
106102 | Record (Map.Map Name Expr)
107103 | Unit
108104 | Tuple Expr Expr (Maybe Expr)
109− | Shader Text Text Shader.Shader
105+ | Shader Shader.Source Shader.Types
110106
111107
112108data CaseBranch =
@@ -114,7 +110,7 @@ data CaseBranch =
114110
115111
116112data FieldUpdate =
117− FieldUpdate R.Region Expr
113+ FieldUpdate A.Region Expr
118114
119115
120116
@@ -154,8 +150,8 @@ data Pattern_
154150 | PList [Pattern]
155151 | PCons Pattern Pattern
156152 | PBool Union Bool
157− | PChr Utf8
158− | PStr Utf8
153+ | PChr Utf8.String
154+ | PStr Utf8.String
159155 | PInt Int
160156 | PCtor
161157 { _p_home :: ModuleName.Canonical
@@ -231,7 +227,6 @@ fieldsToList fields =
231227data Module =
232228 Module
233229 { _name :: ModuleName.Canonical
234− , _docs :: Docs
235230 , _exports :: Exports
236231 , _decls :: Decls
237232 , _unions :: Map.Map Name Union
@@ -266,24 +261,11 @@ data Ctor =
266261
267262
268263
269−-- DOCS
270−
271−
272−data Docs
273− = NoDocs R.Region
274− | YesDocs
275− { _region :: R.Region
276− , _overview :: B.ByteString
277− , _comments :: Map.Map Name Text
278− }
279−
280−
281−
282264-- EXPORTS
283265
284266
285267data Exports
286− = ExportEverything R.Region
268+ = ExportEverything A.Region
287269 | Export (Map.Map Name (A.Located Export))
288270
289271
@@ -303,7 +285,7 @@ data Export
303285data Effects
304286 = NoEffects
305287 | Ports (Map.Map Name Port)
306− | Manager R.Region R.Region R.Region Manager
288+ | Manager A.Region A.Region A.Region Manager
307289
308290
309291data Port