Added a pass to turn all List types into Mobile List

This commit is contained in:
Neil Brown 2008-06-01 19:26:40 +00:00
parent e66ce1f810
commit 231d037cb3

View File

@ -69,7 +69,8 @@ rainPasses = let f = makePassesDep' ((== FrontendRain) . csFrontend) in f
--TODO add an export property. Maybe check other things too (lack of comms etc -- but that could be combined with occam?) --TODO add an export property. Maybe check other things too (lack of comms etc -- but that could be combined with occam?)
,("Pull up par declarations", pullUpParDeclarations, [], [Prop.rainParDeclarationsPulledUp]) ,("Pull up par declarations", pullUpParDeclarations, [], [Prop.rainParDeclarationsPulledUp])
,("Implicit mobility pass", implicitMobility, [], []) ,("Mobilise lists", mobiliseLists, [], []) --TODO properties
,("Implicit mobility pass", implicitMobility, [], []) --TODO properties
] ]
-- | A pass that transforms all instances of 'A.Int' into 'A.Int64' -- | A pass that transforms all instances of 'A.Int' into 'A.Int64'
@ -275,6 +276,13 @@ pullUpParDeclarations = applyDepthM pullUpParDeclarations'
Just (trans,inner') -> Just ( (A.Spec m spec) . trans,inner') Just (trans,inner') -> Just ( (A.Spec m spec) . trans,inner')
chaseSpecs _ = Nothing chaseSpecs _ = Nothing
mobiliseLists :: PassType
mobiliseLists x = (get >>= applyDepthM mobilise >>= put) >> applyDepthM mobilise x
where
mobilise :: A.Type -> PassM A.Type
mobilise t@(A.List _) = return $ A.Mobile t
mobilise t = return t
-- | All the items that should not occur in an AST that comes from Rain (up until it goes into the shared passes). -- | All the items that should not occur in an AST that comes from Rain (up until it goes into the shared passes).
excludeNonRainFeatures :: (Data t, CSMR m) => t -> m t excludeNonRainFeatures :: (Data t, CSMR m) => t -> m t
excludeNonRainFeatures = excludeConstr excludeNonRainFeatures = excludeConstr