Skip to content
Snippets Groups Projects
Commit 275a38a6 authored by Emmanouil (Manos) Koukoutos's avatar Emmanouil (Manos) Koukoutos Committed by Etienne Kneuss
Browse files

Reorder some datagen productions

parent 35b53057
No related branches found
No related tags found
No related merge requests found
...@@ -57,7 +57,10 @@ class NaiveDataGen(ctx: LeonContext, p: Program, evaluator: Evaluator, _bounds : ...@@ -57,7 +57,10 @@ class NaiveDataGen(ctx: LeonContext, p: Program, evaluator: Evaluator, _bounds :
// generating lists. // generating lists.
val ccChildren = act.knownCCDescendents val ccChildren = act.knownCCDescendents
val (leafs,conss) = ccChildren.partition(_.fields.size == 0) val (leafs,conss) = ccChildren.partition(_.fields.isEmpty)
// FIXME: Will not work for mutually recursive types
val sortedConss = conss sortBy { _.fields.count{ _.getType.isInstanceOf[ClassType]}}
// The stream for leafs... // The stream for leafs...
val leafsStream = leafs.toStream.flatMap { cct => val leafsStream = leafs.toStream.flatMap { cct =>
...@@ -65,7 +68,7 @@ class NaiveDataGen(ctx: LeonContext, p: Program, evaluator: Evaluator, _bounds : ...@@ -65,7 +68,7 @@ class NaiveDataGen(ctx: LeonContext, p: Program, evaluator: Evaluator, _bounds :
} }
// ...to which we append the streams for constructors. // ...to which we append the streams for constructors.
leafsStream.append(interleave(conss.map { cct => leafsStream.append(interleave(sortedConss.map { cct =>
generate(cct) generate(cct)
})) }))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment