make datatypes enumerator behavior clearer (no exceptions in normal operation)
authorMorgan Deters <mdeters@cs.nyu.edu>
Thu, 7 Feb 2013 02:30:35 +0000 (21:30 -0500)
committerMorgan Deters <mdeters@cs.nyu.edu>
Thu, 7 Feb 2013 02:32:58 +0000 (21:32 -0500)
src/theory/datatypes/type_enumerator.h

index 2a14d7fbab13f351f4bebb684092863748652995..8ee275f70927a27845563b9ed7609c1b94cda4da 100644 (file)
@@ -139,11 +139,10 @@ public:
   DatatypesEnumerator& operator++() throw() {
     if(d_ctor < d_datatype.getNumConstructors()) {
       for(size_t a = d_datatype[d_ctor].getNumArgs(); a > 0; --a) {
-        try {
-          *++*d_argEnumerators[a - 1];
-          return *this;
-        } catch(NoMoreValuesException&) {
+        if((++*d_argEnumerators[a - 1]).isFinished()) {
           *d_argEnumerators[a - 1] = TypeEnumerator(Node::fromExpr(d_datatype[d_ctor][a - 1].getSelector()).getType()[1]);
+        } else {
+          return *this;
         }
       }