@@ -25,14 +25,13 @@ import qualified Reporting.Result as Result
2525
2626
2727declarations
28− :: Bool
29− -> [D.SourceDecl]
28+ :: [D.SourceDecl]
3029 -> Result.Result wrn Error.Error [D.ValidDecl]
31−declarations isRoot sourceDecls =
30+declarations sourceDecls =
3231 do validDecls <- validateDecls Nothing sourceDecls
3332 (\_ _ -> validDecls)
3433 <$> declDuplicates validDecls
35− <*> T.traverse (checkDecl isRoot) validDecls
34+ <*> T.traverse checkDecl validDecls
3635
3736
3837validateDecls
@@ -76,9 +75,6 @@ validateDeclsHelp comment (A.A region decl) decls =
7675 D.Definition def ->
7776 defHelp comment def decls
7877
79− D.Port port ->
80− portHelp comment region port decls
81−
8278
8379
8480-- VALIDATE DEFINITIONS IN DECLARATIONS
@@ -116,37 +112,6 @@ defHelp comment (A.A region def) decls =
116112
117113
118114
119−-- VALIDATE PORTS IN DECLARATIONS
120−
121−
122−portHelp
123− :: Maybe String
124− -> R.Region
125− -> D.SourcePort
126− -> [D.SourceDecl]
127− -> Result.Result wrn Error.Error [D.ValidDecl]
128−portHelp comment region port decls =
129− let addRest port' rest =
130− (:) (A.A (region,comment) (D.Port port'))
131− <$> validateDecls Nothing rest
132− in
133− case port of
134− D.PortDefinition name _ ->
135− Result.throw region (Error.PortWithoutAnnotation name)
136−
137− D.PortAnnotation name tipe ->
138− case decls of
139− D.Decl (A.A _ (D.Port (D.PortDefinition name' expr))) : rest
140− | name == name' ->
141− do expr' <- expression expr
142− let port' = D.Out name expr' tipe
143− addRest port' rest
144−
145− _ ->
146− addRest (D.In name tipe) decls
147−
148−
149−
150115-- VALIDATE DEFINITIONS
151116
152117
@@ -283,20 +248,6 @@ expression (A.A ann sourceExpression) =
283248 GLShader uid src gltipe ->
284249 return (GLShader uid src gltipe)
285250
286− Port impl ->
287− Port <$>
288− case impl of
289− In name tipe ->
290− return (In name tipe)
291−
292− Out name expr tipe ->
293− do expr' <- expression expr
294− return (Out name expr' tipe)
295−
296− Task name expr tipe ->
297− do expr' <- expression expr
298− return (Task name expr' tipe)
299−
300251
301252second :: (a, Source.Expr) -> Result.Result wrn Error.Error (a, Valid.Expr)
302253second (value, expr) =
@@ -386,11 +337,6 @@ extractValues (A.A (region, _) decl) =
386337 , [A.A region name]
387338 )
388339
389− D.Port port ->
390− ( [A.A region (D.validPortName port)]
391− , []
392− )
393−
394340 D.Fixity _ _ _ ->
395341 ( []
396342 , []
@@ -401,8 +347,8 @@ extractValues (A.A (region, _) decl) =
401347-- UNBOUND TYPE VARIABLES
402348
403349
404−checkDecl :: Bool -> D.ValidDecl -> Result.Result wrn Error.Error ()
405−checkDecl isRoot (A.A (region,_) decl) =
350+checkDecl :: D.ValidDecl -> Result.Result wrn Error.Error ()
351+checkDecl (A.A (region,_) decl) =
406352 case decl of
407353 D.Definition _ ->
408354 return ()
@@ -433,13 +379,6 @@ checkDecl isRoot (A.A (region,_) decl) =
433379 Result.throw region
434380 (Error.MessyTypeVarsInAlias name boundVars unused unbound)
435381
436− D.Port _ ->
437− if isRoot then
438− return ()
439−
440− else
441− Result.throw region Error.UnexpectedPort
442−
443382 D.Fixity _ _ _ ->
444383 return ()
445384