private static bool CheckMethodMemberForExtensionSyntax(Syntax.InternalSyntax.CSharpSyntaxNode member)
        {
            if (member.Kind == SyntaxKind.MethodDeclaration)
            {
                var methodDecl = (Syntax.InternalSyntax.MethodDeclarationSyntax)member;

                var paramList = methodDecl.parameterList;
                if (paramList != null)
                {
                    var parameters = paramList.Parameters;

                    if (parameters.Count != 0)
                    {
                        var firstParameterType = parameters[0].Type as Syntax.InternalSyntax.ExtendedTypeSyntax;
                        if (firstParameterType != null)
                        {
                            foreach (var modifier in firstParameterType.Modifiers)
                            {
                                if (modifier.Kind == SyntaxKind.ThisKeyword)
                                {
                                    return(true);
                                }
                            }
                        }
                    }
                }
            }
            return(false);
        }
        private static bool CheckMemberForAttributes(Syntax.InternalSyntax.CSharpSyntaxNode member)
        {
            switch (member.Kind)
            {
            case SyntaxKind.CompilationUnit:
                return((((Syntax.InternalSyntax.CompilationUnitSyntax)member).AttributeLists).Any());

            case SyntaxKind.ClassDeclaration:
            case SyntaxKind.StructDeclaration:
            case SyntaxKind.InterfaceDeclaration:
            case SyntaxKind.EnumDeclaration:
                return((((Syntax.InternalSyntax.BaseTypeDeclarationSyntax)member).AttributeLists).Any());

            case SyntaxKind.DelegateDeclaration:
                return((((Syntax.InternalSyntax.DelegateDeclarationSyntax)member).AttributeLists).Any());

            case SyntaxKind.FieldDeclaration:
            case SyntaxKind.EventFieldDeclaration:
                return((((Syntax.InternalSyntax.BaseFieldDeclarationSyntax)member).AttributeLists).Any());

            case SyntaxKind.MethodDeclaration:
            case SyntaxKind.OperatorDeclaration:
            case SyntaxKind.ConversionOperatorDeclaration:
            case SyntaxKind.ConstructorDeclaration:
            case SyntaxKind.DestructorDeclaration:
                return((((Syntax.InternalSyntax.BaseMethodDeclarationSyntax)member).AttributeLists).Any());

            case SyntaxKind.PropertyDeclaration:
            case SyntaxKind.EventDeclaration:
            case SyntaxKind.IndexerDeclaration:
                var  baseProp      = (Syntax.InternalSyntax.BasePropertyDeclarationSyntax)member;
                bool hasAttributes = baseProp.AttributeLists.Any();

                if (!hasAttributes && baseProp.AccessorList != null)
                {
                    foreach (var accessor in baseProp.AccessorList.Accessors)
                    {
                        hasAttributes |= accessor.AttributeLists.Any();
                    }
                }

                return(hasAttributes);
            }

            return(false);
        }
        private static void AddNonTypeMemberNames(
            Syntax.InternalSyntax.CSharpSyntaxNode member, ImmutableHashSet <string> .Builder set, ref bool anyNonTypeMembers)
        {
            switch (member.Kind)
            {
            case SyntaxKind.FieldDeclaration:
                anyNonTypeMembers = true;
                set.Add(((Syntax.InternalSyntax.FieldDeclarationSyntax)member).Declaration.Identifier.ValueText);
                break;

            case SyntaxKind.EventFieldDeclaration:
                anyNonTypeMembers = true;
                set.Add(((Syntax.InternalSyntax.EventFieldDeclarationSyntax)member).Declaration.Identifier.ValueText);
                break;

            case SyntaxKind.MethodDeclaration:
                anyNonTypeMembers = true;
                // Member names are exposed via NamedTypeSymbol.MemberNames and are used primarily
                // as an acid test to determine whether a more in-depth search of a type is worthwhile.
                // We decided that it was reasonable to exclude explicit interface implementations
                // from the list of member names.
                var methodDecl = (Syntax.InternalSyntax.MethodDeclarationSyntax)member;
                if (methodDecl.ExplicitInterfaceSpecifier == null)
                {
                    set.Add(methodDecl.Identifier.ValueText);
                }
                break;

            case SyntaxKind.PropertyDeclaration:
                anyNonTypeMembers = true;
                // Handle in the same way as explicit method implementations
                var propertyDecl = (Syntax.InternalSyntax.PropertyDeclarationSyntax)member;
                if (propertyDecl.ExplicitInterfaceSpecifier == null)
                {
                    set.Add(propertyDecl.Identifier.ValueText);
                }
                break;

            case SyntaxKind.EventDeclaration:
                anyNonTypeMembers = true;
                // Handle in the same way as explicit method implementations
                var eventDecl = (Syntax.InternalSyntax.EventDeclarationSyntax)member;
                if (eventDecl.ExplicitInterfaceSpecifier == null)
                {
                    set.Add(eventDecl.Identifier.ValueText);
                }
                break;

            case SyntaxKind.ConstructorDeclaration:
                anyNonTypeMembers = true;
                set.Add(((Syntax.InternalSyntax.ConstructorDeclarationSyntax)member).Modifiers.Any((int)SyntaxKind.StaticKeyword)
                        ? WellKnownMemberNames.StaticConstructorName
                        : WellKnownMemberNames.InstanceConstructorName);
                break;

            case SyntaxKind.DestructorDeclaration:
                anyNonTypeMembers = true;
                set.Add(WellKnownMemberNames.DestructorName);
                break;

            case SyntaxKind.IndexerDeclaration:
                anyNonTypeMembers = true;
                set.Add(WellKnownMemberNames.Indexer);
                break;

            case SyntaxKind.OperatorDeclaration:
                anyNonTypeMembers = true;
                var opDecl = (Syntax.InternalSyntax.OperatorDeclarationSyntax)member;
                var name   = OperatorFacts.OperatorNameFromDeclaration(opDecl);
                set.Add(name);
                break;

            case SyntaxKind.ConversionOperatorDeclaration:
                anyNonTypeMembers = true;
                set.Add(((Syntax.InternalSyntax.ConversionOperatorDeclarationSyntax)member).ImplicitOrExplicitKeyword.Kind == SyntaxKind.ImplicitKeyword
                        ? WellKnownMemberNames.ImplicitConversionName
                        : WellKnownMemberNames.ExplicitConversionName);
                break;

            case SyntaxKind.GlobalStatement:
                anyNonTypeMembers = true;
                break;
            }
        }