Mono.CSharp.DocUtil.FindDocumentedMemberNoNest C# (CSharp) Method

FindDocumentedMemberNoNest() private static method

private static FindDocumentedMemberNoNest ( MemberCore mc, System.TypeSpec type, string member_name, AParametersCollection param_list, DeclSpace ds, int &warning_type, string cref, bool warn419, string name_for_error, Report Report ) : MemberSpec
mc MemberCore
type System.TypeSpec
member_name string
param_list AParametersCollection
ds DeclSpace
warning_type int
cref string
warn419 bool
name_for_error string
Report Report
return MemberSpec
		private static MemberSpec FindDocumentedMemberNoNest (
			MemberCore mc, TypeSpec type, string member_name,
			AParametersCollection param_list, DeclSpace ds, out int warning_type, 
			string cref, bool warn419, string name_for_error, Report Report)
		{
			warning_type = 0;
//			var filter = new MemberFilter (member_name, 0, MemberKind.All, param_list, null);
			IList<MemberSpec> found = null;
			while (type != null && found == null) {
				found = MemberCache.FindMembers (type, member_name, false);
				type = type.DeclaringType;
			}

			if (found == null)
				return null;

			if (warn419 && found.Count > 1) {
				Report419 (mc, name_for_error, found.ToArray (), Report);
			}

			return found [0];

/*
			if (param_list == null) {
				// search for fields/events etc.
				mis = TypeManager.MemberLookup (type, null,
					type, MemberKind.All,
					BindingRestriction.None,
					member_name, null);
				mis = FilterOverridenMembersOut (mis);
				if (mis == null || mis.Length == 0)
					return null;
				if (warn419 && IsAmbiguous (mis))
					Report419 (mc, name_for_error, mis, Report);
				return mis [0];
			}

			MethodSignature msig = new MethodSignature (member_name, null, param_list);
			mis = FindMethodBase (type, 
				BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance,
				msig);

			if (warn419 && mis.Length > 0) {
				if (IsAmbiguous (mis))
					Report419 (mc, name_for_error, mis, Report);
				return mis [0];
			}

			// search for operators (whose parameters exactly
			// matches with the list) and possibly report CS1581.
			string oper = null;
			string return_type_name = null;
			if (member_name.StartsWith ("implicit operator ")) {
				Operator.GetMetadataName (Operator.OpType.Implicit);
				return_type_name = member_name.Substring (18).Trim (wsChars);
			}
			else if (member_name.StartsWith ("explicit operator ")) {
				oper = Operator.GetMetadataName (Operator.OpType.Explicit);
				return_type_name = member_name.Substring (18).Trim (wsChars);
			}
			else if (member_name.StartsWith ("operator ")) {
				oper = member_name.Substring (9).Trim (wsChars);
				switch (oper) {
				// either unary or binary
				case "+":
					oper = param_list.Length == 2 ?
						Operator.GetMetadataName (Operator.OpType.Addition) :
						Operator.GetMetadataName (Operator.OpType.UnaryPlus);
					break;
				case "-":
					oper = param_list.Length == 2 ?
						Operator.GetMetadataName (Operator.OpType.Subtraction) :
						Operator.GetMetadataName (Operator.OpType.UnaryNegation);
					break;
				default:
					oper = Operator.GetMetadataName (oper);
					if (oper != null)
						break;

					warning_type = 1584;
					Report.Warning (1020, 1, mc.Location, "Overloadable {0} operator is expected", param_list.Length == 2 ? "binary" : "unary");
					Report.Warning (1584, 1, mc.Location, "XML comment on `{0}' has syntactically incorrect cref attribute `{1}'",
						mc.GetSignatureForError (), cref);
					return null;
				}
			}
			// here we still don't consider return type (to
			// detect CS1581 or CS1002+CS1584).
			msig = new MethodSignature (oper, null, param_list);

			mis = FindMethodBase (type, 
				BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance,
				msig);
			if (mis.Length == 0)
				return null; // CS1574
			var mi = mis [0];
			TypeSpec expected = mi is MethodSpec ?
				((MethodSpec) mi).ReturnType :
				mi is PropertySpec ?
				((PropertySpec) mi).PropertyType :
				null;
			if (return_type_name != null) {
				TypeSpec returnType = FindDocumentedType (mc, return_type_name, ds, cref, Report);
				if (returnType == null || returnType != expected) {
					warning_type = 1581;
					Report.Warning (1581, 1, mc.Location, "Invalid return type in XML comment cref attribute `{0}'", cref);
					return null;
				}
			}
			return mis [0];
*/ 
		}