コード例 #1
0
 //
 // ParseMethodForOverloadedName
 //
 // Overload created when method names match
 //
 private void ParseMethodForOverloadedName(MethodFacet facet)
 {
     // Flag if method names match
     if (this.Name == facet.Name)
     {
         this.IsOverloadedNameMethod  = true;
         facet.IsOverloadedNameMethod = true;
     }
 }
コード例 #2
0
 //
 // ParseMethodForOverloadedParameters
 //
 // Overload created when method parameter names match
 //
 private void ParseMethodForOverloadedParameters(MethodFacet facet)
 {
     // Flag if method parameter names match
     if (MethodParameterNamesEqual(facet))
     {
         this.IsOverloadedParameterMethod  = true;
         facet.IsOverloadedParameterMethod = true;
     }
 }
コード例 #3
0
 /// <summary>
 /// Parse methods for overrides
 /// </summary>
 /// <param name="methods">List of methods to parse.</param>
 protected void ParseMethodsForOverrides(IList <MethodFacet> methods)
 {
     for (int i = 0; i < methods.Count(); i++)
     {
         MethodFacet method = methods[i];
         for (int j = i + 1; j < methods.Count(); j++)
         {
             method.ParseMethodForOverride(methods[j]);
         }
     }
 }
コード例 #4
0
        //
        // ParseMethodForOverride
        //
        public void ParseMethodForOverride(MethodFacet facet)
        {
            if (!facet.IsOverloadedNameMethod)
            {
                ParseMethodForOverloadedName(facet);
            }

            if (facet.IsOverloadedNameMethod)
            {
                ParseMethodForOverloadedParameters(facet);
            }

            if (facet.IsOverloadedNameMethod)
            {
                ParseMethodForOverloadedSignature(facet);
            }
        }
コード例 #5
0
 //
 // ParseMethodForOverloadedSignature
 //
 // Override created when class method signatures match.
 // In this case the method return types must differ.
 //
 // c# methods overload according to their parameter signature only.
 // Explicit interfaces can be used to separate method implementations with identical signatures.
 //
 // However use of explicit operators (see System.Decimal) can give rise to multiple method definitions
 // (when viewed from the perspective of reflection) that share the same signature.
 // In this case we flag the existence of the signature overload.
 //
 // In some cases our reflection also throws up methods (in say EF 6b1) that meet this critera
 // PLUS they have a matching return type.
 // Perhaps the reflection code is not suitably descrptive in some casees.
 // In this case we flag the existence of the duplicate.
 private void ParseMethodForOverloadedSignature(MethodFacet facet)
 {
     // Flag if method type signatures match
     if (MethodParameterTypesEqual(facet))
     {
         if (this.Type == facet.Type)
         {
             this.IsDuplicateSignatureMethod  = true;
             facet.IsDuplicateSignatureMethod = true;
         }
         else
         {
             this.IsOverloadedSignatureMethod  = true;
             facet.IsOverloadedSignatureMethod = true;
         }
     }
 }
コード例 #6
0
        //
        // MethodParameterNamesEqual
        //
        public bool MethodParameterNamesEqual(MethodFacet facet)
        {
            bool equal = false;

            if (this.Parameters.Count() == facet.Parameters.Count())
            {
                bool presumption = true;
                for (int i = 0; i < this.Parameters.Count(); i++)
                {
                    if (this.Parameters[i].Name != facet.Parameters[i].Name)
                    {
                        presumption = false;
                        break;
                    }
                }
                equal = presumption;
            }
            return(equal);
        }