Inheritance: IRecursiveElementProcessor
        private void VisitLoop(ITreeNode loop, IHighlightingConsumer consumer)
        {
            var function = loop.GetContainingNode<IJsFunctionLike>();
            var accessAnalizer = new VariableCollector();
            loop.ProcessThisAndDescendants(accessAnalizer);
            var accessToExternalModifiedClosure = accessAnalizer.Variables
                .GroupBy(r => r.DeclaredElement)
                .Select(g => g.ToArray())
                .Where(l => HasExternallyModifiedClosure(function, l))
                .SelectMany(l => l)
                .Where(r => r.FunctionLike != function)
                .Select(info => info.Node);

            foreach (var expression in accessToExternalModifiedClosure)
            {
                consumer.AddHighlighting(new AccessToModifiedClosureWarning(expression), expression.GetHighlightingRange(), File);
            }
        }
Exemplo n.º 2
0
        private void VisitLoop(ITreeNode loop, IHighlightingConsumer consumer)
        {
            var function       = loop.GetContainingNode <IJsFunctionLike>();
            var accessAnalizer = new VariableCollector();

            loop.ProcessThisAndDescendants(accessAnalizer);
            var accessToExternalModifiedClosure = accessAnalizer.Variables
                                                  .GroupBy(r => r.DeclaredElement)
                                                  .Select(g => g.ToArray())
                                                  .Where(l => HasExternallyModifiedClosure(function, l))
                                                  .SelectMany(l => l)
                                                  .Where(r => r.FunctionLike != function)
                                                  .Select(info => info.Node);

            foreach (var expression in accessToExternalModifiedClosure)
            {
                consumer.AddHighlighting(new AccessToModifiedClosureWarning(expression), expression.GetHighlightingRange(), File);
            }
        }