示例#1
0
 public override TypeNode VisitTypeNode(TypeNode typeNode)
 {
     //if (WeakPurityAndWriteEffectsAnalysis.classFilter.Length != 0 && !typeNode.FullName.Contains(WeakPurityAndWriteEffectsAnalysis.classFilter))
     if (ptwe != null)
     {
         if (ptwe.moduleFilter.Length != 0 &&
             !typeNode.GetFullUnmangledNameWithTypeParameters().Contains(ptwe.moduleFilter))
         {
             return(typeNode);
         }
     }
     return(base.VisitTypeNode(typeNode));
 }
示例#2
0
        /// <summary>
        /// This is used for explicitly implemented interfaces to convert the template to the format used in the
        /// comments file.
        /// </summary>
        /// <param name="type">The explicitly implemented interface type</param>
        /// <param name="sb">The string builder to which the name is written</param>
        private static void WriteTemplate(TypeNode eiiType, StringBuilder sb)
        {
            // !EFW Use this instead of the template name as the type parameter may be different in the user's
            // code (i.e. Collection<TControl> instead of Collection<T>.
            string eiiClean = eiiType.GetFullUnmangledNameWithTypeParameters();

            eiiClean = eiiClean.Replace('.', '#');
            eiiClean = eiiClean.Replace('+', '#');  // !EFW - Treat nested class separators like periods
            eiiClean = eiiClean.Replace(',', '@');  // Change the separator between parameters
            eiiClean = eiiClean.Replace('<', '{');  // Change the parameter brackets
            eiiClean = eiiClean.Replace('>', '}');

            sb.Append(eiiClean);
        }
 public string GetFullUnmangledNameWithTypeParameters()
 {
     return(fxCopType.GetFullUnmangledNameWithTypeParameters());
 }
示例#4
0
        public virtual string GetMemberSignature(Member mem, bool withFullInformation)
        {
            if (mem == null)
            {
                return("");
            }
            string   name = null;
            TypeNode type = null;

            switch (mem.NodeType)
            {
            case NodeType.InstanceInitializer:
            case NodeType.Method:
                name = this.GetMethodSignature((Method)mem, true, withFullInformation);
                type = ((Method)mem).ReturnType;
                break;

            case NodeType.Property:
                ParameterList pars = ((Property)mem).Parameters;
                if (pars == null || pars.Count == 0)
                {
                    name = this.GetMemberName(mem);
                }
                else
                {
                    name = this.GetSignatureString(this.GetMemberName(mem), pars, "[", "]", ", ", withFullInformation);
                }
                type = ((Property)mem).Type;
                break;

            case NodeType.Field:
                type = ((Field)mem).Type;
                goto default;

            default:
                if (withFullInformation)
                {
                    TypeAlias talias = mem as TypeAlias;
                    if (talias != null)
                    {
                        return(this.GetMemberSignature(talias.AliasedType, true));
                    }
                    ITypeParameter itp = mem as ITypeParameter;
                    if (itp != null)
                    {
                        TypeNode dt = itp.DeclaringMember as TypeNode;
                        if (dt != null)
                        {
                            return(dt.GetFullUnmangledNameWithTypeParameters());
                        }
                        Method dm = itp.DeclaringMember as Method;
                        if (dm != null)
                        {
                            return(dm.GetFullUnmangledNameWithTypeParameters(true));
                        }
                    }
                }
                name = this.GetMemberName(mem);
                break;
            }
            if (!withFullInformation)
            {
                return(name);
            }
            string        kind   = this.GetMemberKindForSignature(mem);
            StringBuilder result = new StringBuilder();
            string        astr   = this.GetMemberAccessString(mem);

            if (astr != null)
            {
                result.Append(astr);
                result.Append(' ');
            }
            result.Append(kind);
            if (mem.IsStatic && !(mem is TypeNode))
            {
                result.Append("static ");
            }
            if (type != null && !(mem is InstanceInitializer))
            {
                result.Append(this.GetTypeName(type));
                result.Append(' ');
            }
            result.Append(name);
            return(result.ToString());
        }