Skip to content
Snippets Groups Projects
Commit 7252b1a9 authored by Manos Koukoutos's avatar Manos Koukoutos
Browse files

Simplify traverse a little

parent 72b2374f
No related branches found
No related tags found
No related merge requests found
...@@ -1185,11 +1185,9 @@ object ExprOps { ...@@ -1185,11 +1185,9 @@ object ExprOps {
} }
def traverse(funDef: FunDef): Seq[T] = { def traverse(funDef: FunDef): Seq[T] = {
// @mk FIXME: This seems overly compicated val precTs = funDef.precondition.toSeq.flatMap(traverse)
val precondition = funDef.precondition.map(e => matchToIfThenElse(e)).toSeq val bodyTs = funDef.body.toSeq.flatMap(traverse(_, funDef.precondition.toSeq))
val precTs = funDef.precondition.map(e => traverse(e)).toSeq.flatten val postTs = funDef.postcondition.toSeq.flatMap(traverse)
val bodyTs = funDef.body.map(e => traverse(e, precondition)).toSeq.flatten
val postTs = funDef.postcondition.map(p => traverse(p)).toSeq.flatten
precTs ++ bodyTs ++ postTs precTs ++ bodyTs ++ postTs
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment