Ejemplo n.º 1
0
 public void Initialize()
 {
     foreach (var v in modSet)
     {
         varDefs[v] = Expr.Ident(v);
     }
     foreach (var cmd in cmds)
     {
         if (cmd.Item2 == null)
         {
             varDefs[cmd.Item1] = null;
         }
         else
         {
             var s = new SubstitutionDuplicator(varDefs);
             var r = (Expr)s.Visit(cmd.Item2);
             varDefs[cmd.Item1] = s.isSubstitutable ? r : null;
         }
     }
 }
Ejemplo n.º 2
0
            void UpdateAssignment(Variable variable, Expr rhs, Dictionary <Variable, Expr> newVarDefs)
            {
                if ((varDefs.ContainsKey(variable) && varDefs[variable] == null) ||
                    rhs == null)
                {
                    newVarDefs[variable] = null;
                    return;
                }

                var s = new SubstitutionDuplicator(newVarDefs);
                var r = (Expr)s.Visit(rhs);

                if (s.isSubstitutable)
                {
                    newVarDefs[variable] = r;
                }
                else
                {
                    newVarDefs[variable] = null;
                }
            }