예제 #1
0
        public static List <AttributeSyntax> OutputAttribute(this ConstructorDeclarationSyntax node)
        {
            if (node == null)
            {
                return(new List <AttributeSyntax>());
            }

            return(node.GetAttributes("Output"));
        }
예제 #2
0
        public static Span HasValidPreviousVersionAttribute(this ConstructorDeclarationSyntax node)
        {
            if (node == null || node.IsDeprecated() || !node.HasAttribute("PreviousVersion"))
            {
                return(null); //Don't care about deprecated methods or if the method does not have the attribute at all
            }
            List <AttributeSyntax> previousVersionAttributes = node.GetAttributes("PreviousVersion");

            string currentVersion = BH.Engine.Test.CodeCompliance.Query.CurrentAssemblyFileVersion();

            foreach (AttributeSyntax a in previousVersionAttributes)
            {
                string givenVersion = a.ArgumentList.Arguments[0].Expression.GetFirstToken().Value.ToString();

                if (givenVersion != currentVersion)
                {
                    return(node.Identifier.Span.ToSpan());
                }
            }

            return(null); //All ok
        }