Ejemplo n.º 1
0
        public ConstParameterSubstitutionRewriter(FacetList[] facetAxes, SemanticModel semanticModel)
        {
            facetAxes = Array.FindAll(facetAxes, delegate(FacetList candidate) { return(String.Equals(candidate.axisTag, "Feature")); });
            if (facetAxes.Length != 1)
            {
                throw new ArgumentException();
            }
            featureFacetAxis = facetAxes[0];

            this.semanticModel = semanticModel;
        }
Ejemplo n.º 2
0
        public static bool TestEnumeratedFacetAttribute(SyntaxList <AttributeListSyntax> attributeLists, out ExpressionSyntax expressionOut, string[] attributeAliases, FacetList facetsList)
        {
            foreach (AttributeListSyntax attributeList in attributeLists)
            {
                foreach (AttributeSyntax attribute in attributeList.Attributes)
                {
                    IdentifierNameSyntax attributeName;
                    if ((attributeName = attribute.Name as IdentifierNameSyntax) != null)
                    {
                        if (Array.IndexOf(attributeAliases, attributeName.Identifier.Text) >= 0)
                        {
                            expressionOut = attribute.ArgumentList.Arguments[0].Expression;

                            for (int i = 1; i < attribute.ArgumentList.Arguments.Count; i++)
                            {
                                MemberAccessExpressionSyntax argumentEnumTag = (MemberAccessExpressionSyntax)attribute.ArgumentList.Arguments[i].Expression;
                                if (Array.IndexOf(facetsList.facets, argumentEnumTag.Name.Identifier.Text) >= 0)
                                {
                                    return(true);
                                }
                            }
                        }
                    }
                }
            }

            expressionOut = null;
            return(false);
        }