Ejemplo n.º 1
0
 bool RewriteMatchingLoop()
 {
     if (expr is QuantifierExpr)
     {
         QuantifierExpr    quantifier = (QuantifierExpr)expr;
         var               l          = new List <QuantifierWithTriggers>();
         List <Expression> splits     = new List <Expression>();
         bool              rewritten  = false;
         foreach (var q in quantifiers)
         {
             if (TriggerUtils.NeedsAutoTriggers(q.quantifier) && TriggerUtils.WantsMatchingLoopRewrite(q.quantifier))
             {
                 var matchingLoopRewriter = new MatchingLoopRewriter();
                 var qq = matchingLoopRewriter.RewriteMatchingLoops(q);
                 splits.Add(qq);
                 l.Add(new QuantifierWithTriggers(qq));
                 rewritten = true;
             }
             else
             {
                 // don't rewrite the quantifier if we are not auto generate triggers.
                 // This is because rewriting introduces new boundvars and will cause
                 // user provided triggers not mention all boundvars
                 splits.Add(q.quantifier);
                 l.Add(q);
             }
         }
         if (rewritten)
         {
             quantifier.SplitQuantifier = splits;
             quantifiers = l;
             return(true);
         }
     }
     return(false);
 }