Ejemplo n.º 1
0
        internal bool AppliesTo(ISymbol symbol, ISymbolCategorizationService categorizationService)
        {
            if (ApplicableSymbolKindList.Any() && !ApplicableSymbolKindList.Any(k => k.AppliesTo(symbol)))
            {
                return(false);
            }

            if (!RequiredModifierList.All(m => m.MatchesSymbol(symbol)))
            {
                return(false);
            }

            if (ApplicableAccessibilityList.Any() && !ApplicableAccessibilityList.Any(k => k.MatchesSymbol(symbol)))
            {
                return(false);
            }

            // TODO: More efficient to find the categorizers that are relevant and only check those
            var applicableCategories = categorizationService.GetCategorizers().SelectMany(c => c.Categorize(symbol));

            if (!RequiredCustomTagList.All(t => applicableCategories.Contains(t)))
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 2
0
        public bool AppliesTo(
            SymbolKindOrTypeKind kind,
            DeclarationModifiers modifiers,
            Accessibility?accessibility
            )
        {
            if (!ApplicableSymbolKindList.Any(k => k.Equals(kind)))
            {
                return(false);
            }

            var collapsedModifiers = CollapseModifiers(RequiredModifierList);

            if ((modifiers & collapsedModifiers) != collapsedModifiers)
            {
                return(false);
            }

            if (accessibility.HasValue && !ApplicableAccessibilityList.Any(k => k == accessibility))
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 3
0
        internal bool AppliesTo(ISymbol symbol)
        {
            if (ApplicableSymbolKindList.Any() && !ApplicableSymbolKindList.Any(k => k.AppliesTo(symbol)))
            {
                return(false);
            }

            // Modifiers must match exactly
            if (!RequiredModifierList.All(m => m.MatchesSymbol(symbol)))
            {
                return(false);
            }

            if (ApplicableAccessibilityList.Any() && !ApplicableAccessibilityList.Any(k => k.MatchesSymbol(symbol)))
            {
                return(false);
            }

            return(true);
        }