Exemplo n.º 1
0
    public static async Task <HashSet <ILocalSymbol> > GetDescendantsToInlineInLoopAsync(this Solution solution, SemanticModel semanticModel, VisualBasicSyntaxNode methodNode)
    {
        var forEachControlVariables = await methodNode.DescendantNodes().OfType <ForEachBlockSyntax>().SelectAsync(forEach => GetLoopVariablesToInlineAsync(solution, semanticModel, forEach));

#pragma warning disable RS1024 // Compare symbols correctly - analyzer bug, this is the comparer the docs recommend
        return(new HashSet <ILocalSymbol>(forEachControlVariables.Where(f => f != null), SymbolEqualityComparer.IncludeNullability));

#pragma warning restore RS1024 // Compare symbols correctly
    }
        public static async Task <HashSet <ILocalSymbol> > GetDescendantsToInlineInLoopAsync(this Solution solution, SemanticModel semanticModel, VisualBasicSyntaxNode methodNode)
        {
            var forEachControlVariables = await methodNode.DescendantNodes().OfType <VBSyntax.ForEachBlockSyntax>().SelectAsync(forEach => GetLoopVariablesToInlineAsync(solution, semanticModel, forEach));

            return(new HashSet <ILocalSymbol>(forEachControlVariables.Where(f => f != null), SymbolEquivalenceComparer.Instance));
        }