示例#1
0
        private string GetFullName(ISymbol symbol, out string prefix)
        {
            prefix = string.Empty;
            if (symbol is IMethodSymbol methodSymbol)
            {
                return(LibraryHelper.GetFullName(methodSymbol));
            }
            else if (symbol is IFieldSymbol fieldSymbol)
            {
                return(LibraryHelper.GetFullName(fieldSymbol));
            }
            else if (symbol is INamespaceOrTypeSymbol namespaceOrTypeSymbol)
            {
                return(LibraryHelper.GetFullName(namespaceOrTypeSymbol));
            }
            else if (symbol is ILocalSymbol localSymbol)
            {
                return(LibraryHelper.GetFullName(localSymbol));
            }
            else if (symbol is IParameterSymbol parameterSymbol)
            {
                return(LibraryHelper.GetFullName(parameterSymbol));
            }
            else if (symbol is IPropertySymbol propertySymbol)
            {
                var mode = this.PropertyMode;
                prefix = mode == PropertyMode.Write ? "set_" : "get_";
                return(LibraryHelper.GetFullName(propertySymbol, prefix));
            }
            else if (symbol != null)
            {
                string interfaces = string.Join(",", symbol.GetType().GetInterfaces().Where(x => x.IsPublic).Select(x => x.Name));
                throw new NotImplementedException("Unknwon symbol: " + interfaces);
            }

            return(null);
        }
示例#2
0
 public void MarkAsAnonymous(INamedTypeSymbol symbol)
 {
     createdNames[LibraryHelper.GetFullName(symbol)] = string.Empty;
 }