Ejemplo n.º 1
0
 protected override StringBuilder AppendMethodName(StringBuilder buf, MethodDefinition method)
 {
     if (DocUtils.IsExplicitlyImplemented(method))
     {
         TypeReference   iface;
         MethodReference ifaceMethod;
         DocUtils.GetInfoForExplicitlyImplementedMethod(method, out iface, out ifaceMethod);
         return(buf.Append(new CSharpMemberFormatter(this.TypeMap).GetName(iface))
                .Append('.')
                .Append(ifaceMethod.Name));
     }
     return(base.AppendMethodName(buf, method));
 }
        private static bool IsEII(MethodDefinition methdef)
        {
            if (methdef != null)
            {
                TypeReference   iface;
                MethodReference imethod;

                if (methdef.Overrides.Count == 1)
                {
                    DocUtils.GetInfoForExplicitlyImplementedMethod(methdef, out iface, out imethod);
                    var ifaceRes = iface.Resolve();
                    if (ifaceRes != null)
                    {
                        if (ifaceRes.IsInterface)
                        {
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }
Ejemplo n.º 3
0
        protected override StringBuilder AppendMethodName(StringBuilder buf, MethodDefinition method)
        {
            if (DocUtils.IsExplicitlyImplemented(method))
            {
                TypeReference   iface;
                MethodReference ifaceMethod;
                DocUtils.GetInfoForExplicitlyImplementedMethod(method, out iface, out ifaceMethod);
                return(buf.Append(new CSharpMemberFormatter(this.TypeMap).GetName(iface))
                       .Append('.')
                       .Append(ifaceMethod.Name));
            }

            if (method.Name.StartsWith("op_", StringComparison.Ordinal))
            {
                // this is an operator
                switch (method.Name)
                {
                case "op_Implicit":
                case "op_Explicit":
                    buf.Length--;     // remove the last space, which assumes a member name is coming
                    return(buf);

                case "op_Addition":
                case "op_UnaryPlus":
                    return(buf.Append("operator +"));

                case "op_Subtraction":
                case "op_UnaryNegation":
                    return(buf.Append("operator -"));

                case "op_Division":
                    return(buf.Append("operator /"));

                case "op_Multiply":
                    return(buf.Append("operator *"));

                case "op_Modulus":
                    return(buf.Append("operator %"));

                case "op_BitwiseAnd":
                    return(buf.Append("operator &"));

                case "op_BitwiseOr":
                    return(buf.Append("operator |"));

                case "op_ExclusiveOr":
                    return(buf.Append("operator ^"));

                case "op_LeftShift":
                    return(buf.Append("operator <<"));

                case "op_RightShift":
                    return(buf.Append("operator >>"));

                case "op_LogicalNot":
                    return(buf.Append("operator !"));

                case "op_OnesComplement":
                    return(buf.Append("operator ~"));

                case "op_Decrement":
                    return(buf.Append("operator --"));

                case "op_Increment":
                    return(buf.Append("operator ++"));

                case "op_True":
                    return(buf.Append("operator true"));

                case "op_False":
                    return(buf.Append("operator false"));

                case "op_Equality":
                    return(buf.Append("operator =="));

                case "op_Inequality":
                    return(buf.Append("operator !="));

                case "op_LessThan":
                    return(buf.Append("operator <"));

                case "op_LessThanOrEqual":
                    return(buf.Append("operator <="));

                case "op_GreaterThan":
                    return(buf.Append("operator >"));

                case "op_GreaterThanOrEqual":
                    return(buf.Append("operator >="));

                default:
                    return(base.AppendMethodName(buf, method));
                }
            }
            else
            {
                return(base.AppendMethodName(buf, method));
            }
        }