public override IEnumerable <InspectionResultBase> GetInspectionResults()
        {
            var declarations = UserDeclarations.ToArray();
            var issues       = new List <ParameterCanBeByValInspectionResult>();

            var interfaceDeclarationMembers = declarations.FindInterfaceMembers().ToArray();
            var interfaceScopes             = declarations.FindInterfaceImplementationMembers().Concat(interfaceDeclarationMembers).Select(s => s.Scope).ToArray();

            issues.AddRange(GetResults(declarations, interfaceDeclarationMembers));

            var eventMembers           = declarations.Where(item => !item.IsBuiltIn && item.DeclarationType == DeclarationType.Event).ToArray();
            var formEventHandlerScopes = State.FindFormEventHandlers().Select(handler => handler.Scope).ToArray();
            var eventHandlerScopes     = State.DeclarationFinder.FindEventHandlers().Concat(declarations.FindUserEventHandlers()).Select(e => e.Scope).ToArray();
            var eventScopes            = eventMembers.Select(s => s.Scope)
                                         .Concat(formEventHandlerScopes)
                                         .Concat(eventHandlerScopes)
                                         .ToArray();

            issues.AddRange(GetResults(declarations, eventMembers));

            var declareScopes = declarations.Where(item =>
                                                   item.DeclarationType == DeclarationType.LibraryFunction ||
                                                   item.DeclarationType == DeclarationType.LibraryProcedure)
                                .Select(e => e.Scope)
                                .ToArray();

            issues.AddRange(declarations.OfType <ParameterDeclaration>()
                            .Where(declaration => IsIssue(declaration, declarations, declareScopes, eventScopes, interfaceScopes))
                            .Select(issue => new ParameterCanBeByValInspectionResult(this, State, issue, issue.Context, issue.QualifiedName)));

            return(issues);
        }
        protected override IEnumerable <IInspectionResult> DoGetInspectionResults()
        {
            var declarations = UserDeclarations.ToArray();
            var issues       = new List <IInspectionResult>();

            var interfaceDeclarationMembers = State.DeclarationFinder.FindAllInterfaceMembers().ToArray();
            var interfaceScopes             = State.DeclarationFinder.FindAllInterfaceImplementingMembers().Concat(interfaceDeclarationMembers).Select(s => s.Scope).ToArray();

            issues.AddRange(GetResults(declarations, interfaceDeclarationMembers));

            var eventMembers           = declarations.Where(item => item.DeclarationType == DeclarationType.Event).ToArray();
            var formEventHandlerScopes = State.FindFormEventHandlers().Select(handler => handler.Scope).ToArray();
            var eventHandlerScopes     = State.DeclarationFinder.FindEventHandlers().Concat(declarations.FindUserEventHandlers()).Select(e => e.Scope).ToArray();
            var eventScopes            = eventMembers.Select(s => s.Scope)
                                         .Concat(formEventHandlerScopes)
                                         .Concat(eventHandlerScopes)
                                         .ToArray();

            issues.AddRange(GetResults(declarations, eventMembers));

            var declareScopes = declarations.Where(item =>
                                                   item.DeclarationType == DeclarationType.LibraryFunction ||
                                                   item.DeclarationType == DeclarationType.LibraryProcedure)
                                .Select(e => e.Scope)
                                .ToArray();

            issues.AddRange(declarations.OfType <ParameterDeclaration>()
                            .Where(declaration => IsIssue(declaration, declarations, declareScopes, eventScopes, interfaceScopes))
                            .Select(issue => new DeclarationInspectionResult(this, string.Format(InspectionResults.ParameterCanBeByValInspection, issue.IdentifierName), issue)));

            return(issues);
        }