on master help sign in
Update validation for new Reporting.Annotation
commit1aa236adc4840a42c62add68ad98f0ec07ece8d0 authorEvan Czaplicki <evancz@users.noreply.github.com> dateFri 17 Nov 2017, 13:58 (9 years ago) parent179fad8
1 file changed+18−18
src/Validate.hs+18−18
src/Validate.hs+18−18
@@ -62,7 +62,7 @@ vsdHelp decls stuff =
6262 [] ->
6363 Result.ok stuff
6464
65− A.A region decl : otherDecls ->
65+ A.At region decl : otherDecls ->
6666 case decl of
6767 Src.Union name tvars ctors ->
6868 do let union = Valid.Union name tvars ctors
@@ -83,12 +83,12 @@ vsdHelp decls stuff =
8383 Src.Docs docs ->
8484 validateDocs docs otherDecls stuff
8585
86− Src.Annotation (A.A _ name) tipe ->
86+ Src.Annotation (A.At _ name) tipe ->
8787 validateAnnotation region name tipe otherDecls stuff
8888
8989 Src.Definition name args body ->
9090 do validBody <- expression body
91− let validDecl = A.A region (Valid.Decl name args validBody Nothing)
91+ let validDecl = A.At region (Valid.Decl name args validBody Nothing)
9292 vsdHelp otherDecls $ stuff { _decls = validDecl : _decls stuff }
9393
9494
@@ -102,7 +102,7 @@ validateDocs docs decls stuff =
102102 [] ->
103103 error "TODO no docs on nothing"
104104
105− A.A _ decl : _ ->
105+ A.At _ decl : _ ->
106106 do name <- getNameForDocs decl
107107 vsdHelp decls $ stuff { _docs = Map.insert name docs (_docs stuff) }
108108
@@ -110,10 +110,10 @@ validateDocs docs decls stuff =
110110getNameForDocs :: Src.Decl_ -> Result w N.Name
111111getNameForDocs decl =
112112 case decl of
113− Src.Union (A.A _ name) _ _ ->
113+ Src.Union (A.At _ name) _ _ ->
114114 return name
115115
116− Src.Alias (A.A _ name) _ _ ->
116+ Src.Alias (A.At _ name) _ _ ->
117117 return name
118118
119119 Src.Binop _ _ _ _ ->
@@ -125,10 +125,10 @@ getNameForDocs decl =
125125 Src.Docs _ ->
126126 error "TODO no docs on docs"
127127
128− Src.Annotation (A.A _ name) _ ->
128+ Src.Annotation (A.At _ name) _ ->
129129 return name
130130
131− Src.Definition (A.A _ name) _ _ ->
131+ Src.Definition (A.At _ name) _ _ ->
132132 return name
133133
134134
@@ -142,13 +142,13 @@ validateAnnotation annRegion annotationName tipe decls stuff =
142142 [] ->
143143 error "TODO no attotations on nothing"
144144
145− A.A defRegion decl : otherDecls ->
145+ A.At defRegion decl : otherDecls ->
146146 case decl of
147− Src.Definition name@(A.A _ definitionName) args body ->
147+ Src.Definition name@(A.At _ definitionName) args body ->
148148 if annotationName == definitionName then
149149 do validBody <- expression body
150150 let region = R.merge annRegion defRegion
151− let validDecl = A.A region (Valid.Decl name args validBody (Just tipe))
151+ let validDecl = A.At region (Valid.Decl name args validBody (Just tipe))
152152 vsdHelp otherDecls $ stuff { _decls = validDecl : _decls stuff }
153153
154154 else
@@ -163,8 +163,8 @@ validateAnnotation annRegion annotationName tipe decls stuff =
163163
164164
165165expression :: Src.Expr -> Result w Valid.Expr
166−expression (A.A region sourceExpression) =
167− A.A region <$>
166+expression (A.At region sourceExpression) =
167+ A.At region <$>
168168 case sourceExpression of
169169 Src.Var prefix name ->
170170 pure (Valid.Var prefix name)
@@ -260,19 +260,19 @@ definitions sourceDefs =
260260 [] ->
261261 return []
262262
263− A.A region (Src.Destruct pattern expr) : otherDefs ->
263+ A.At region (Src.Destruct pattern expr) : otherDefs ->
264264 (:)
265265 <$> validateDestruct region pattern expr
266266 <*> definitions otherDefs
267267
268− A.A region (Src.Define name args expr) : otherDefs ->
268+ A.At region (Src.Define name args expr) : otherDefs ->
269269 (:)
270270 <$> validateDefinition region name args expr Nothing
271271 <*> definitions otherDefs
272272
273− A.A annRegion (Src.Annotate annotationName tipe) : otherDefs ->
273+ A.At annRegion (Src.Annotate annotationName tipe) : otherDefs ->
274274 case otherDefs of
275− A.A defRegion (Src.Define name@(A.A _ definitionName) args expr) : otherOtherDefs
275+ A.At defRegion (Src.Define name@(A.At _ definitionName) args expr) : otherOtherDefs
276276 | definitionName == annotationName ->
277277 (:)
278278 <$> validateDefinition (R.merge annRegion defRegion) name args expr (Just tipe)
@@ -323,5 +323,5 @@ validateEffects effects ports =
323323
324324noPorts :: [Valid.Port] -> Result w ()
325325noPorts ports =
326− forM_ ports $ \(Valid.Port (A.A region name) _) ->
326+ forM_ ports $ \(Valid.Port (A.At region name) _) ->
327327 Result.throw region (Error.UnexpectedPort name)