Esempio n. 1
0
        public static bool NeedsClassTag(INamedTypeSymbol symbol, string templateID)
        {
            //For types, unlike methods, this requires that they're specified in Translations.xml. TODO: Determine these programmatically.
            //var symbol = Program.GetModel(typeSyntax).GetDeclaredSymbol(typeSyntax);

            var trans = NeedsClassTagTranslation.Get(TypeProcessor.GenericTypeName(symbol));

            if (trans == null || trans.TypesHashSet == null)
            {
                return(false);
            }
            else
            {
                return(trans.TypesHashSet.Contains(templateID));
            }
        }
Esempio n. 2
0
        private static HashSet <string> TryGetBCLClassTags(IMethodSymbol method)
        {
            var methodStr = TypeProcessor.GenericTypeName(method.ContainingType) + "." + method.Name;

            var trans = NeedsClassTagTranslation.Get(methodStr);

            if (trans == null)
            {
                return(null);
            }

            if (trans.TypesHashSet != null)
            {
                return(trans.TypesHashSet);
            }
            else
            {
                return(method.TypeParameters.ToArray().Select(o => o.ToString()).ToHashSet(true));
            }
        }