Cleared up a couple of remaining uses of SYB
This commit is contained in:
parent
48018a0acf
commit
a05facb7ad
|
@ -36,7 +36,7 @@ import Control.Monad.Reader
|
||||||
import Control.Monad.State
|
import Control.Monad.State
|
||||||
import Data.Array.IArray
|
import Data.Array.IArray
|
||||||
import qualified Data.Foldable as F
|
import qualified Data.Foldable as F
|
||||||
import Data.Generics hiding (GT)
|
import Data.Generics (Data, Typeable)
|
||||||
import Data.Int
|
import Data.Int
|
||||||
import Data.List
|
import Data.List
|
||||||
import qualified Data.Map as Map
|
import qualified Data.Map as Map
|
||||||
|
@ -46,6 +46,7 @@ import qualified Data.Traversable as T
|
||||||
|
|
||||||
import qualified AST as A
|
import qualified AST as A
|
||||||
import CompState
|
import CompState
|
||||||
|
import Data.Generics.Polyplate.Schemes
|
||||||
import Errors
|
import Errors
|
||||||
import Metadata
|
import Metadata
|
||||||
import Omega
|
import Omega
|
||||||
|
@ -561,7 +562,7 @@ makeEquations accesses bound
|
||||||
reps' :: [Var]
|
reps' :: [Var]
|
||||||
reps' = map (Var . A.Variable emptyMeta) reps
|
reps' = map (Var . A.Variable emptyMeta) reps
|
||||||
vs :: [Var]
|
vs :: [Var]
|
||||||
vs = map Var $ listify (const True :: A.Variable -> Bool) e
|
vs = map Var $ listifyDepth (const True :: A.Variable -> Bool) e
|
||||||
|
|
||||||
-- | A front-end to the setIndexVar' function
|
-- | A front-end to the setIndexVar' function
|
||||||
setIndexVar :: A.Variable -> Int -> [FlattenedExp] -> [FlattenedExp]
|
setIndexVar :: A.Variable -> Int -> [FlattenedExp] -> [FlattenedExp]
|
||||||
|
|
|
@ -19,9 +19,10 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
module UsageCheckUtils (Decl(..), emptyVars, flattenParItems, foldUnionVars, getVarProcCall, getVarProc, labelUsageFunctions, mapUnionVars, ParItems(..), processVarW, transformParItems, UsageLabel(..), Var(..), Vars(..), vars) where
|
module UsageCheckUtils (Decl(..), emptyVars, flattenParItems, foldUnionVars, getVarProcCall, getVarProc, labelUsageFunctions, mapUnionVars, ParItems(..), processVarW, transformParItems, UsageLabel(..), Var(..), Vars(..), vars) where
|
||||||
|
|
||||||
import Control.Applicative
|
import Control.Applicative
|
||||||
|
import Control.Monad.State
|
||||||
import Control.Monad.Writer (tell)
|
import Control.Monad.Writer (tell)
|
||||||
import qualified Data.Foldable as F
|
import qualified Data.Foldable as F
|
||||||
import Data.Generics hiding (GT)
|
import Data.Generics (Data, Typeable)
|
||||||
import Data.List
|
import Data.List
|
||||||
import qualified Data.Map as Map
|
import qualified Data.Map as Map
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
|
@ -30,6 +31,7 @@ import qualified Data.Traversable as T
|
||||||
|
|
||||||
import qualified AST as A
|
import qualified AST as A
|
||||||
import CompState
|
import CompState
|
||||||
|
import Data.Generics.Polyplate.Schemes
|
||||||
import Errors
|
import Errors
|
||||||
import FlowGraph
|
import FlowGraph
|
||||||
import Metadata
|
import Metadata
|
||||||
|
@ -227,13 +229,13 @@ getVarExpList (A.IntrinsicFunctionCallList _ _ es) = foldUnionVars $ map getVarE
|
||||||
getVarExpList (A.AllocChannelBundle {}) = emptyVars
|
getVarExpList (A.AllocChannelBundle {}) = emptyVars
|
||||||
|
|
||||||
getVarExp :: A.Expression -> Vars
|
getVarExp :: A.Expression -> Vars
|
||||||
getVarExp = everything unionVars (emptyVars `mkQ` getVarExp')
|
getVarExp e = execState (applyBottomUpM getVarExp' e) emptyVars
|
||||||
where
|
where
|
||||||
--Only need to deal with the two cases where we can see an A.Variable directly;
|
--Only need to deal with the two cases where we can see an A.Variable directly;
|
||||||
--the generic recursion will take care of nested expressions, and even the expressions used as subscripts
|
--the generic recursion will take care of nested expressions, and even the expressions used as subscripts
|
||||||
getVarExp' :: A.Expression -> Vars
|
getVarExp' :: A.Expression -> State Vars A.Expression
|
||||||
getVarExp' (A.ExprVariable _ v) = processVarR v
|
getVarExp' e@(A.ExprVariable _ v) = modify (unionVars $ processVarR v) >> return e
|
||||||
getVarExp' _ = emptyVars
|
getVarExp' e = return e
|
||||||
|
|
||||||
getVarSpec :: A.Specification -> Vars
|
getVarSpec :: A.Specification -> Vars
|
||||||
getVarSpec (A.Specification _ n st) = get st
|
getVarSpec (A.Specification _ n st) = get st
|
||||||
|
|
Loading…
Reference in New Issue
Block a user