Inheritance: InterfaceMemberBase, IParametersMember
Example #1
0
 		/// <summary>
 		/// Cls compliance check whether methods or constructors parameters differing only in ref or out, or in array rank
 		/// </summary>
 		/// 
		// TODO: refactor as method is always 'this'
 		public static void VerifyClsParameterConflict (ArrayList al, MethodCore method, MemberInfo this_builder, Report Report)
 		{
 			EntryType tested_type = (method is Constructor ? EntryType.Constructor : EntryType.Method) | EntryType.Public;
 
 			for (int i = 0; i < al.Count; ++i) {
 				MemberCache.CacheEntry entry = (MemberCache.CacheEntry) al [i];
 		
 				// skip itself
 				if (entry.Member == this_builder)
 					continue;
 		
 				if ((entry.EntryType & tested_type) != tested_type)
 					continue;
 		
				MethodBase method_to_compare = (MethodBase)entry.Member;
				AttributeTester.Result result = AttributeTester.AreOverloadedMethodParamsClsCompliant (
					method.Parameters, TypeManager.GetParameterData (method_to_compare));

 				if (result == AttributeTester.Result.Ok)
 					continue;

				IMethodData md = TypeManager.GetMethod (method_to_compare);

				// TODO: now we are ignoring CLSCompliance(false) on method from other assembly which is buggy.
				// However it is exactly what csc does.
				if (md != null && !md.IsClsComplianceRequired ())
					continue;
 		
 				Report.SymbolRelatedToPreviousError (entry.Member);
				switch (result) {
				case AttributeTester.Result.RefOutArrayError:
					Report.Warning (3006, 1, method.Location,
							"Overloaded method `{0}' differing only in ref or out, or in array rank, is not CLS-compliant",
							method.GetSignatureForError ());
					continue;
				case AttributeTester.Result.ArrayArrayError:
					Report.Warning (3007, 1, method.Location,
							"Overloaded method `{0}' differing only by unnamed array types is not CLS-compliant",
							method.GetSignatureForError ());
					continue;
				}

				throw new NotImplementedException (result.ToString ());
 			}
  		}
Example #2
0
File: doc.cs Project: speier/shake
 //
 // Raised (and passed an XmlElement that contains the comment)
 // when GenerateDocComment is writing documentation expectedly.
 //
 // FIXME: with a few effort, it could be done with XmlReader,
 // that means removal of DOM use.
 //
 internal static void OnMethodGenerateDocComment(
     MethodCore mc, XmlElement el, Report Report)
 {
     var paramTags = new Dictionary<string, string> ();
     foreach (XmlElement pelem in el.SelectNodes ("param")) {
         string xname = pelem.GetAttribute ("name");
         if (xname.Length == 0)
             continue; // really? but MS looks doing so
         if (xname != "" && mc.ParameterInfo.GetParameterIndexByName (xname) < 0)
             Report.Warning (1572, 2, mc.Location, "XML comment on `{0}' has a param tag for `{1}', but there is no parameter by that name",
                 mc.GetSignatureForError (), xname);
         else if (paramTags.ContainsKey (xname))
             Report.Warning (1571, 2, mc.Location, "XML comment on `{0}' has a duplicate param tag for `{1}'",
                 mc.GetSignatureForError (), xname);
         paramTags [xname] = xname;
     }
     IParameterData [] plist = mc.ParameterInfo.FixedParameters;
     foreach (Parameter p in plist) {
         if (paramTags.Count > 0 && !paramTags.ContainsKey (p.Name))
             Report.Warning (1573, 4, mc.Location, "Parameter `{0}' has no matching param tag in the XML comment for `{1}'",
                 p.Name, mc.GetSignatureForError ());
     }
 }
Example #3
0
        public bool IsDuplicateImplementation(MethodCore method)
        {
            if (!MemberName.Equals (method.MemberName))
                return false;

            TypeSpec[] param_types = method.ParameterTypes;

            if (param_types == null || param_types.Length != ParameterTypes.Length)
                return false;

            for (int i = 0; i < param_types.Length; i++)
                if (param_types [i] != ParameterTypes [i])
                    return false;

            Report.SymbolRelatedToPreviousError (method);
            Report.Error (82, Location, "A member `{0}' is already reserved",
                method.GetSignatureForError ());
            return true;
        }
Example #4
0
		internal static void OnMethodGenerateDocComment (MethodCore mc, XmlElement el)
		{
		}
Example #5
0
 public bool AreAccessorsDuplicateImplementation(MethodCore mc)
 {
     return Add.IsDuplicateImplementation (mc) || Remove.IsDuplicateImplementation (mc);
 }
Example #6
0
 /// <summary>
 /// Tests whether accessors are not in collision with some method (CS0111)
 /// </summary>
 public bool AreAccessorsDuplicateImplementation(MethodCore mc)
 {
     return Get.IsDuplicateImplementation (mc) || Set.IsDuplicateImplementation (mc);
 }