Ejemplo n.º 1
0
    /// <summary>
    /// 更新语法树
    /// </summary>
    /// <param name="oldCode">旧代码</param>
    /// <param name="newCode">新代码</param>
    /// <param name="sets">新的引用</param>
    public override void Update(string oldCode, string newCode, HashSet <string> sets = default)
    {
        //先移除
        if (TreeCache.ContainsKey(oldCode))
        {
            while (!TreeCache.TryRemove(oldCode, out _))
            {
            }
            ;
        }
        if (sets == default)
        {
            if (ReferenceCache.ContainsKey(oldCode))
            {
                sets = ReferenceCache[oldCode];
                while (!ReferenceCache.TryRemove(oldCode, out _))
                {
                }
                ;
            }
        }

        //再添加
        AddTreeToCache(newCode);
        ReferenceCache[newCode] = sets;
    }
Ejemplo n.º 2
0
 public CompilationException Update(string old, string @new, HashSet <string> sets = default)
 {
     if (TreeCache.ContainsKey(old))
     {
         while (!TreeCache.TryRemove(old, out _))
         {
         }
         ;
     }
     if (sets == default)
     {
         if (UsingCache.ContainsKey(old))
         {
             sets = UsingCache[old];
             while (!UsingCache.TryRemove(old, out _))
             {
             }
             ;
         }
     }
     return(Add(@new, sets));
 }
Ejemplo n.º 3
0
    public override void Update(string old, string @new, HashSet <string> sets = default)
    {
        if (TreeCache.ContainsKey(old))
        {
            while (!TreeCache.TryRemove(old, out _))
            {
            }
            ;
        }
        if (sets == default)
        {
            if (ReferenceCache.ContainsKey(old))
            {
                sets = ReferenceCache[old];
                while (!ReferenceCache.TryRemove(old, out _))
                {
                }
                ;
            }
        }

        AddTreeToCache(@new);
        ReferenceCache[@new] = sets;
    }
Ejemplo n.º 4
0
        public virtual void Update(string old, string @new, HashSet <string> sets = default)
        {
            if (TreeCache.ContainsKey(old))
            {
                while (!TreeCache.TryRemove(old, out _))
                {
                }
                ;
            }
            if (sets == default)
            {
                if (UsingCache.ContainsKey(old))
                {
                    sets = UsingCache[old];
                    while (!UsingCache.TryRemove(old, out _))
                    {
                    }
                    ;
                }
            }

            AddTreeToCache(@new);
            UsingCache[@new] = sets;
        }