StmtLHS traversal includes LHSs for loop parts

This commit is contained in:
Zachary Snow 2019-04-17 17:44:12 -04:00
parent 07b64bd1f2
commit 8d77856b1e
1 changed files with 11 additions and 0 deletions

View File

@ -332,6 +332,17 @@ traverseStmtLHSsM mapper = stmtMapper
return $ Asgn (Just $ Event sense') lhs' expr
stmtMapper (AsgnBlk op lhs expr) = fullMapper lhs >>= \lhs' -> return $ AsgnBlk op lhs' expr
stmtMapper (Asgn mt lhs expr) = fullMapper lhs >>= \lhs' -> return $ Asgn mt lhs' expr
stmtMapper (For inits me incrs stmt) = do
inits' <- mapM mapInit inits
let (lhss, asgnOps, exprs) = unzip3 incrs
lhss' <- mapM fullMapper lhss
let incrs' = zip3 lhss' asgnOps exprs
return $ For inits' me incrs' stmt
where
mapInit (Left decl) = return $ Left decl
mapInit (Right (lhs, expr)) = do
lhs' <- fullMapper lhs
return $ Right (lhs', expr)
stmtMapper (Assertion a) =
assertionMapper a >>= return . Assertion
stmtMapper other = return other