private void RemapVarMapKey(VarMap varMap, Var newVar)
            {
                Var var = varMap[this.m_oldVar];

                varMap.Remove(this.m_oldVar);
                varMap.Add(newVar, var);
            }
示例#2
0
            // <summary>
            // Replaces the entry in the varMap in which m_oldVar is a key
            // with an entry in which newVAr is the key and the value remains the same.
            // </summary>
            private void RemapVarMapKey(VarMap varMap, Var newVar)
            {
                var value = varMap[m_oldVar];

                varMap.Remove(m_oldVar);
                varMap.Add(newVar, value);
            }
示例#3
0
        private void PruneVarMap(VarMap varMap)
        {
            List <Var> varList = new List <Var>();

            foreach (Var key in varMap.Keys)
            {
                if (!this.IsReferenced(key))
                {
                    varList.Add(key);
                }
                else
                {
                    this.AddReference(varMap[key]);
                }
            }
            foreach (Var key in varList)
            {
                varMap.Remove(key);
            }
        }
示例#4
0
 // <summary>
 // Prunes a VarMap - gets rid of unreferenced vars from the VarMap inplace
 // Additionally, propagates var references to the inner vars
 // </summary>
 private void PruneVarMap(VarMap varMap)
 {
     var unreferencedVars = new List<Var>();
     // build up a list of unreferenced vars
     foreach (var v in varMap.Keys)
     {
         if (!IsReferenced(v))
         {
             unreferencedVars.Add(v);
         }
         else
         {
             AddReference(varMap[v]);
         }
     }
     // remove each of the corresponding entries from the varmap
     foreach (var v in unreferencedVars)
     {
         varMap.Remove(v);
     }
 }