Esempio n. 1
0
        public static string GetFragmentType(AttributeNodeCollection attributes)
        {
            ArgumentUtility.CheckNotNull("attributes", attributes);
            string fragmentType = SymbolTable.EMPTY_FRAGMENT;

            if (ContainsFragment(attributes))
            {
                string fragmentFullName = typeof(FragmentAttribute).FullName;

                foreach (AttributeNode attributeNode in attributes)
                {
                    if (IsFragment(attributeNode))
                    {
                        if (attributeNode.Type.FullName == fragmentFullName)
                        {
                            foreach (Literal literal in attributeNode.Expressions)
                            {
                                string value = literal.Value as string;
                                if (value != null)
                                {
                                    fragmentType = value;
                                }
                            }
                        }
                        else
                        {
                            fragmentType = attributeNode.Type.Name.Name.Replace("Attribute", "");
                        }
                    }
                }
            }
            return(fragmentType);
        }
        public static Fragment GetFragmentType(AttributeNodeCollection attributes)
        {
            var fragmentType = Fragment.CreateEmpty();

            if (attributes != null && ContainsFragment(attributes))
            {
                string fragmentFullName = typeof(FragmentAttribute).FullName;

                foreach (AttributeNode attributeNode in attributes)
                {
                    if (IsFragment(attributeNode))
                    {
                        if (attributeNode.Type.FullName == fragmentFullName)
                        {
                            foreach (Literal literal in attributeNode.Expressions)
                            {
                                string value = literal.Value as string;
                                if (value != null)
                                {
                                    fragmentType = Fragment.CreateNamed(value);
                                }
                            }
                        }
                        else
                        {
                            fragmentType = Fragment.CreateNamed(attributeNode.Type.Name.Name.Replace("Attribute", ""));
                        }
                    }
                }
            }
            return(fragmentType);
        }
        public static Fragment GetFragmentType(AttributeNodeCollection attributes)
        {
            var fragmentType = Fragment.CreateEmpty();
              if (attributes != null && ContainsFragment (attributes))
              {
            string fragmentFullName = typeof (FragmentAttribute).FullName;

            foreach (AttributeNode attributeNode in attributes)
            {
              if (IsFragment (attributeNode))
              {
            if (attributeNode.Type.FullName == fragmentFullName)
            {
              foreach (Literal literal in attributeNode.Expressions)
              {
                string value = literal.Value as string;
                if (value != null)
                {
                  fragmentType = Fragment.CreateNamed(value);
                }
              }
            }
            else
            {
              fragmentType = Fragment.CreateNamed (attributeNode.Type.Name.Name.Replace ("Attribute", ""));
            }
              }
            }
              }
              return fragmentType;
        }
Esempio n. 4
0
        public static string GetFragmentType(AttributeNodeCollection attributes)
        {
            ArgumentUtility.CheckNotNull ("attributes", attributes);
              string fragmentType = SymbolTable.EMPTY_FRAGMENT;
              if (ContainsFragment (attributes))
              {
            string fragmentFullName = typeof (FragmentAttribute).FullName;

            foreach (AttributeNode attributeNode in attributes)
            {
              if (IsFragment (attributeNode))
              {
            if (attributeNode.Type.FullName == fragmentFullName)
            {
              foreach (Literal literal in attributeNode.Expressions)
              {
                string value = literal.Value as string;
                if (value != null)
                {
                  fragmentType = value;
                }
              }
            }
            else
            {
              fragmentType = attributeNode.Type.Name.Name.Replace ("Attribute", "");
            }
              }
            }
              }
              return fragmentType;
        }
        private static bool ContainsFragmentGeneratorAttribute(AttributeNodeCollection attributes)
        {
            bool containsFragmentGeneratorAttribute = false;

            if (attributes != null)
            {
                containsFragmentGeneratorAttribute = attributes.Any(IsFragmentGeneratorAttribute);
            }
            return(containsFragmentGeneratorAttribute);
        }
Esempio n. 6
0
        private static bool ContainsCompilerGeneratedAttribute(AttributeNodeCollection attributes)
        {
            bool containsCompilerGeneratedAttribute = false;

            if (attributes != null)
            {
                containsCompilerGeneratedAttribute = attributes.Any(attribute => IsCompilerGeneratedAttribute(attribute));
            }
            return(containsCompilerGeneratedAttribute);
        }
Esempio n. 7
0
 private void SetSymbolFragmentType(string name, AttributeNodeCollection attributes)
 {
     if (!_result.Contains(name))
     {
         if (FragmentUtility.ContainsFragment(attributes))
         {
             Fragment fragmentType = FragmentUtility.GetFragmentType(attributes);
             _result.MakeSafe(name, fragmentType);
         }
         else
         {
             _result.MakeUnsafe(name);
         }
     }
 }
 private void SetSymbolFragmentType(string name, AttributeNodeCollection attributes)
 {
     if (!_result.Contains (name))
       {
     if (FragmentUtility.ContainsFragment (attributes))
     {
       Fragment fragmentType = FragmentUtility.GetFragmentType (attributes);
       _result.MakeSafe (name, fragmentType);
     }
     else
     {
       _result.MakeUnsafe (name);
     }
       }
 }
        public static Fragment InferReturnFragmentType(Method method)
        {
            Fragment fragmentType;
            AttributeNodeCollection definingAttributes = GetDefiningAttributes(method);

            if (definingAttributes != null)
            {
                fragmentType = FragmentUtility.GetFragmentType(definingAttributes);
            }
            else
            {
                fragmentType = Fragment.CreateEmpty();
            }

            return(fragmentType);
        }
Esempio n. 10
0
        public static AttributeNode GetAttribute(AttributeNodeCollection attributes, Type target)
        {
            if (attributes == null || target == null)
            {
                return(null);
            }

            foreach (AttributeNode attribute in attributes)
            {
                if (attribute.Type.FullName.Equals(target.FullName, StringComparison.Ordinal))
                {
                    return(attribute);
                }
            }
            return(null);
        }
Esempio n. 11
0
 public static bool ContainsFragment(AttributeNodeCollection attributes)
 {
     ArgumentUtility.CheckNotNull("attributes", attributes);
     return(attributes.Any(IsFragment));
 }
		private bool HasMessageContractAttribute(AttributeNodeCollection attributes)
        {
			return SemanticRulesUtilities.GetAttribute(attributes, typeof(MessageContractAttribute)) != null;
        }
 private bool HasMessageContractAttribute(AttributeNodeCollection attributes)
 {
     return(SemanticRulesUtilities.GetAttribute(attributes, typeof(MessageContractAttribute)) != null);
 }
Esempio n. 14
0
 public static bool ContainsFragment(AttributeNodeCollection attributes)
 {
     ArgumentUtility.CheckNotNull ("attributes", attributes);
       return attributes.Any (IsFragment);
 }
Esempio n. 15
0
 private static bool ContainsFragmentGeneratorAttribute(AttributeNodeCollection attributes)
 {
     bool containsFragmentGeneratorAttribute = false;
       if (attributes != null)
       {
     containsFragmentGeneratorAttribute = attributes.Any(IsFragmentGeneratorAttribute);
       }
       return containsFragmentGeneratorAttribute;
 }