Fixed the checkFunction pass
This commit is contained in:
parent
dcf419744a
commit
7af49a2d10
|
@ -253,23 +253,20 @@ transformRangeRep = everywhereM (mkM transformRangeRep')
|
||||||
transformRangeRep' s = return s
|
transformRangeRep' s = return s
|
||||||
|
|
||||||
checkFunction :: Data t => t -> PassM t
|
checkFunction :: Data t => t -> PassM t
|
||||||
checkFunction = return {- everywhereM (mkM transformFunction')
|
checkFunction = everywhereM (mkM checkFunction')
|
||||||
where
|
where
|
||||||
transformFunction' :: A.SpecType -> PassM A.SpecType
|
checkFunction' :: A.Specification -> PassM A.Specification
|
||||||
transformFunction' (A.Function m specMode types params body)
|
checkFunction' spec@(A.Specification _ n (A.Function m _ _ _ (Right body)))
|
||||||
= case body of
|
= case body of
|
||||||
(A.Only _ (A.Seq m' (A.Several m'' statements))) ->
|
(A.Seq m' (A.Several m'' statements)) ->
|
||||||
if (null statements)
|
if (null statements)
|
||||||
then dieP m "Functions must not have empty bodies"
|
then dieP m "Functions must not have empty bodies"
|
||||||
else case (last statements) of
|
else case (last statements) of
|
||||||
ret@(A.OnlyEL {}) -> return $
|
(A.Only _ (A.Assign _ [A.Variable _ dest] _)) -> if A.nameName n == A.nameName dest then return spec else
|
||||||
(A.Function m specMode types params
|
dieP m "Functions must have a return statement as their last statement."
|
||||||
(A.ProcThen m' (A.Seq m' (A.Several m'' (init statements))) ret)
|
|
||||||
)
|
|
||||||
_ -> dieP m "Functions must have a return statement as their last statement"
|
_ -> dieP m "Functions must have a return statement as their last statement"
|
||||||
_ -> dieP m "Functions must have seq[uential] bodies"
|
_ -> dieP m "Functions must have seq[uential] bodies"
|
||||||
transformFunction' s = return s
|
checkFunction' s = return s
|
||||||
-}
|
|
||||||
|
|
||||||
pullUpParDeclarations :: Data t => t -> PassM t
|
pullUpParDeclarations :: Data t => t -> PassM t
|
||||||
pullUpParDeclarations = everywhereM (mkM pullUpParDeclarations')
|
pullUpParDeclarations = everywhereM (mkM pullUpParDeclarations')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user