internal static Symbols.Method ResolveCall(Symbols.Container BaseReference, string MethodName, MemberInfo[] Members, object[] Arguments, string[] ArgumentNames, Type[] TypeArguments, BindingFlags LookupFlags, bool ReportErrors, ref OverloadResolution.ResolutionFailure Failure) { Failure = OverloadResolution.ResolutionFailure.None; if ((Members[0].MemberType != MemberTypes.Method) && (Members[0].MemberType != MemberTypes.Property)) { Failure = OverloadResolution.ResolutionFailure.InvalidTarget; if (ReportErrors) { throw new ArgumentException(Utils.GetResourceString("ExpressionNotProcedure", new string[] { MethodName, BaseReference.VBFriendlyName })); } return(null); } int length = Arguments.Length; object argument = null; if (Symbols.HasFlag(LookupFlags, BindingFlags.SetProperty)) { if (Arguments.Length == 0) { Failure = OverloadResolution.ResolutionFailure.InvalidArgument; if (ReportErrors) { throw new InvalidCastException(Utils.GetResourceString("PropertySetMissingArgument1", new string[] { MethodName })); } return(null); } object[] sourceArray = Arguments; Arguments = new object[(length - 2) + 1]; Array.Copy(sourceArray, Arguments, Arguments.Length); argument = sourceArray[length - 1]; } Symbols.Method targetProcedure = OverloadResolution.ResolveOverloadedCall(MethodName, Members, Arguments, ArgumentNames, TypeArguments, LookupFlags, ReportErrors, ref Failure); if (Failure != OverloadResolution.ResolutionFailure.None) { return(null); } if (!targetProcedure.ArgumentsValidated && !OverloadResolution.CanMatchArguments(targetProcedure, Arguments, ArgumentNames, TypeArguments, false, null)) { Failure = OverloadResolution.ResolutionFailure.InvalidArgument; if (!ReportErrors) { return(null); } string str = ""; List <string> list = new List <string>(); bool flag = OverloadResolution.CanMatchArguments(targetProcedure, Arguments, ArgumentNames, TypeArguments, false, list); foreach (string str2 in list) { str = str + "\r\n " + str2; } throw new InvalidCastException(Utils.GetResourceString("MatchArgumentFailure2", new string[] { targetProcedure.ToString(), str })); } if (targetProcedure.IsProperty) { if (MatchesPropertyRequirements(targetProcedure, LookupFlags) == null) { Failure = OverloadResolution.ResolutionFailure.InvalidTarget; if (ReportErrors) { throw ReportPropertyMismatch(targetProcedure, LookupFlags); } return(null); } } else if (Symbols.HasFlag(LookupFlags, BindingFlags.SetProperty)) { Failure = OverloadResolution.ResolutionFailure.InvalidTarget; if (ReportErrors) { throw new MissingMemberException(Utils.GetResourceString("MethodAssignment1", new string[] { targetProcedure.AsMethod().Name })); } return(null); } if (!Symbols.HasFlag(LookupFlags, BindingFlags.SetProperty)) { return(targetProcedure); } ParameterInfo[] parameters = GetCallTarget(targetProcedure, LookupFlags).GetParameters(); ParameterInfo parameter = parameters[parameters.Length - 1]; bool requiresNarrowingConversion = false; bool allNarrowingIsFromObject = false; if (OverloadResolution.CanPassToParameter(targetProcedure, argument, parameter, false, false, null, ref requiresNarrowingConversion, ref allNarrowingIsFromObject)) { return(targetProcedure); } Failure = OverloadResolution.ResolutionFailure.InvalidArgument; if (!ReportErrors) { return(null); } string str3 = ""; List <string> errors = new List <string>(); allNarrowingIsFromObject = false; requiresNarrowingConversion = false; bool flag2 = OverloadResolution.CanPassToParameter(targetProcedure, argument, parameter, false, false, errors, ref allNarrowingIsFromObject, ref requiresNarrowingConversion); foreach (string str4 in errors) { str3 = str3 + "\r\n " + str4; } throw new InvalidCastException(Utils.GetResourceString("MatchArgumentFailure2", new string[] { targetProcedure.ToString(), str3 })); }
internal static Symbols.Method ResolveCall(Symbols.Container BaseReference, string MethodName, MemberInfo[] Members, object[] Arguments, string[] ArgumentNames, Type[] TypeArguments, BindingFlags LookupFlags, bool ReportErrors, ref OverloadResolution.ResolutionFailure Failure) { Failure = OverloadResolution.ResolutionFailure.None; if (Members[0].MemberType != MemberTypes.Method && Members[0].MemberType != MemberTypes.Property) { Failure = OverloadResolution.ResolutionFailure.InvalidTarget; if (ReportErrors) { throw new ArgumentException(Utils.GetResourceString("ExpressionNotProcedure", MethodName, BaseReference.VBFriendlyName)); } return((Symbols.Method)null); } int length = Arguments.Length; object obj1 = (object)null; if (Symbols.HasFlag(LookupFlags, BindingFlags.SetProperty)) { if (Arguments.Length == 0) { Failure = OverloadResolution.ResolutionFailure.InvalidArgument; if (ReportErrors) { throw new InvalidCastException(Utils.GetResourceString("PropertySetMissingArgument1", new string[1] { MethodName })); } return((Symbols.Method)null); } object[] objArray = Arguments; Arguments = new object[checked (length - 2 + 1)]; Array.Copy((Array)objArray, (Array)Arguments, Arguments.Length); obj1 = objArray[checked (length - 1)]; } Symbols.Method TargetProcedure1 = OverloadResolution.ResolveOverloadedCall(MethodName, Members, Arguments, ArgumentNames, TypeArguments, LookupFlags, ReportErrors, ref Failure); if (Failure != OverloadResolution.ResolutionFailure.None) { return((Symbols.Method)null); } if (!TargetProcedure1.ArgumentsValidated && !OverloadResolution.CanMatchArguments(TargetProcedure1, Arguments, ArgumentNames, TypeArguments, false, (List <string>)null)) { Failure = OverloadResolution.ResolutionFailure.InvalidArgument; if (ReportErrors) { string str = ""; List <string> Errors = new List <string>(); OverloadResolution.CanMatchArguments(TargetProcedure1, Arguments, ArgumentNames, TypeArguments, false, Errors); List <string> .Enumerator enumerator = Ported.VisualBasic.CompilerServices.OverloadResolution.InitEnumerator <string>(); try { enumerator = Errors.GetEnumerator(); while (enumerator.MoveNext()) { string current = enumerator.Current; str = str + "\r\n " + current; } } finally { enumerator.Dispose(); } throw new InvalidCastException(Utils.GetResourceString("MatchArgumentFailure2", TargetProcedure1.ToString(), str)); } return((Symbols.Method)null); } if (TargetProcedure1.IsProperty) { if (NewLateBinding.MatchesPropertyRequirements(TargetProcedure1, LookupFlags) == null) { Failure = OverloadResolution.ResolutionFailure.InvalidTarget; if (ReportErrors) { throw NewLateBinding.ReportPropertyMismatch(TargetProcedure1, LookupFlags); } return((Symbols.Method)null); } } else if (Symbols.HasFlag(LookupFlags, BindingFlags.SetProperty)) { Failure = OverloadResolution.ResolutionFailure.InvalidTarget; if (ReportErrors) { throw new MissingMemberException(Utils.GetResourceString("MethodAssignment1", new string[1] { TargetProcedure1.AsMethod().Name })); } return((Symbols.Method)null); } if (Symbols.HasFlag(LookupFlags, BindingFlags.SetProperty)) { ParameterInfo[] parameters = NewLateBinding.GetCallTarget(TargetProcedure1, LookupFlags).GetParameters(); ParameterInfo parameterInfo = parameters[checked (parameters.Length - 1)]; Symbols.Method TargetProcedure2 = TargetProcedure1; object obj2 = obj1; ParameterInfo Parameter1 = parameterInfo; int num1 = 0; int num2 = 0; // ISSUE: variable of the null type object local1 = null; bool flag1 = false; ref bool local2 = ref flag1; bool flag2 = false; ref bool local3 = ref flag2;