Ejemplo n.º 1
0
 public void FindAndResolveTacticApplication(Program tacnyProgram, Function fun) {
   if (IsLeaf()) {
     var aps = Data as ApplySuffix;
     if (aps == null)
       return;
     UpdateStmt us = new UpdateStmt(aps.tok, aps.tok, new List<Expression>(), new List<AssignmentRhs> { new ExprRhs(aps) });
     if (tacnyProgram.IsTacticCall(us)) {
       List<IVariable> variables = new List<IVariable>();
       ITactic tac = tacnyProgram.GetTactic(us);
       tacnyProgram.SetCurrent(tac, fun);
       variables.AddRange(fun.Formals);
       // get the resolved variables
       List<IVariable> resolved = new List<IVariable>();
       Console.Out.WriteLine($"Resolving {tac.Name} in {fun.Name}");
       resolved.AddRange(fun.Formals); // add input arguments as resolved variables
       var result = LazyTacny.Atomic.ResolveTactic(us, fun, tacnyProgram, variables, resolved);
       Data = result.State.DynamicContext.generatedExpressions[0];
       tacnyProgram.CurrentDebug.Fin();
       Modified = true;
     }
   } else {
     LChild.FindAndResolveTacticApplication(tacnyProgram, fun);
     RChild?.FindAndResolveTacticApplication(tacnyProgram, fun);
   }
 }