Beispiel #1
0
        public void Merge(IPsiSourceFile sourceFile, object builtPart)
        {
            myShellLocks.AssertWriteAccessAllowed();

            // remove old annotations from all tries
            foreach (var node in mySourceFileToNodes[sourceFile])
            {
                node.Clear(sourceFile);
            }

            mySourceFileToNodes.RemoveKey(sourceFile);
            myFilesWithoutAnnotations.Remove(sourceFile);

            // add built annotations.
            var part = (AttributedTypesTrieCollection)builtPart;

            if (!myRoot.Merge(part, mySourceFileToNodes))
            {
                myFilesWithoutAnnotations.Add(sourceFile);
            }

            myDirtyFiles.Remove(sourceFile);
        }
        public void UpdateIncludes([NotNull] FileSystemPath includer, [NotNull] ICollection <FileSystemPath> includees)
        {
            lock (_locker) {
                foreach (FileSystemPath includee in _includerToIncludees[includer])
                {
                    _includeeToIncluders.Remove(includee, includer);
                }
                _includerToIncludees.RemoveKey(includer);

                if (includees.Count > 0)
                {
                    _includerToIncludees.AddRange(includer, includees);
                    foreach (FileSystemPath includee in includees)
                    {
                        _includeeToIncluders.Add(includee, includer);
                    }
                }
            }
        }
 // Обновляет список вызванных методов для переменных со статусом DependsOnInvocation.
 // Удаляет список вызванных методов для переменных, лишившихся этого статуса.
 private OneToSetMap<IVariableDeclaration, InvokedExpressionData> GetInvokedExpressions(ICollection<ControlFlowElementData> previousElems,
         IDictionary<IVariableDeclaration, VariableDisposeStatus> statusDictionary,
         OneToSetMap<IVariableDeclaration, InvokedExpressionData> invokedExpressions)
 {
     var result = new OneToSetMap<IVariableDeclaration, InvokedExpressionData>(invokedExpressions);
     foreach (var status in statusDictionary)
     {
         if (status.Value != VariableDisposeStatus.DependsOnInvocation)
         {
             if (invokedExpressions.ContainsKey(status.Key))
                 result.RemoveKey(status.Key);
             continue;
         }
         foreach (var previousElem in previousElems)
         {
             if (previousElem == null || !previousElem.IsVisited())
                 continue;
             var previousStatus = previousElem[status.Key];
             if (previousStatus == null)
                 continue;
             if (previousStatus != VariableDisposeStatus.DependsOnInvocation)
                 continue;
             if (previousElem.InvokedExpressions.ContainsKey(status.Key))
                 result.AddRange(status.Key, previousElem.InvokedExpressions[status.Key]);
         }
     }
     return result;
 }