Exemplo n.º 1
0
        // ReSharper disable once CyclomaticComplexity
        public IEnumerable <string> GetLinkedNames(ITypeDeclaration typeDeclaration)
        {
            var attributesOwnerDeclaration = typeDeclaration as IAttributesOwnerDeclaration;

            if (attributesOwnerDeclaration == null)
            {
                yield break;
            }

            foreach (var attribute in attributesOwnerDeclaration.Attributes)
            {
                if (attribute.Name.ShortName != _attributeNameShort && attribute.Name.ShortName != _attributeNameLong)
                {
                    continue;
                }

                foreach (var typeArgument in attribute.Arguments.Select(x => x.Value).OfType <ITypeofExpression>())
                {
                    yield return(typeArgument.ArgumentType.GetPresentableName(typeDeclaration.GetSourceFile().NotNull().PrimaryPsiLanguage));
                }
            }
        }