internal static bool CanBindGet(object Instance, string MemberName, object[] Arguments, string[] ArgumentNames)
 {
     Symbols.Container baseReference = new Symbols.Container(Instance);
     BindingFlags lookupFlags = BindingFlags.GetProperty | BindingFlags.InvokeMethod;
     MemberInfo[] members = baseReference.GetMembers(ref MemberName, false);
     if ((members != null) && (members.Length != 0))
     {
         OverloadResolution.ResolutionFailure failure;
         if (members[0].MemberType == MemberTypes.Field)
         {
             return true;
         }
         Symbols.Method method = ResolveCall(baseReference, MemberName, members, Arguments, ArgumentNames, Symbols.NoTypeArguments, lookupFlags, false, ref failure);
         if (failure == OverloadResolution.ResolutionFailure.None)
         {
             return true;
         }
         if (((Arguments.Length > 0) && (members.Length == 1)) && IsZeroArgumentCall(members[0]))
         {
             method = ResolveCall(baseReference, MemberName, members, Symbols.NoArguments, Symbols.NoArgumentNames, Symbols.NoTypeArguments, lookupFlags, false, ref failure);
             if (failure == OverloadResolution.ResolutionFailure.None)
             {
                 return true;
             }
         }
     }
     return false;
 }
Example #2
0
        internal static bool CanBindGet(object Instance, string MemberName, object[] Arguments, string[] ArgumentNames)
        {
            Symbols.Container baseReference = new Symbols.Container(Instance);
            BindingFlags      lookupFlags   = BindingFlags.GetProperty | BindingFlags.InvokeMethod;

            MemberInfo[] members = baseReference.GetMembers(ref MemberName, false);
            if ((members != null) && (members.Length != 0))
            {
                OverloadResolution.ResolutionFailure failure;
                if (members[0].MemberType == MemberTypes.Field)
                {
                    return(true);
                }
                Symbols.Method method = ResolveCall(baseReference, MemberName, members, Arguments, ArgumentNames, Symbols.NoTypeArguments, lookupFlags, false, ref failure);
                if (failure == OverloadResolution.ResolutionFailure.None)
                {
                    return(true);
                }
                if (((Arguments.Length > 0) && (members.Length == 1)) && IsZeroArgumentCall(members[0]))
                {
                    method = ResolveCall(baseReference, MemberName, members, Symbols.NoArguments, Symbols.NoArgumentNames, Symbols.NoTypeArguments, lookupFlags, false, ref failure);
                    if (failure == OverloadResolution.ResolutionFailure.None)
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
Example #3
0
        internal static bool CanIndexSetComplex(object Instance, object[] Arguments, string[] ArgumentNames, bool OptimisticSet, bool RValueBase)
        {
            OverloadResolution.ResolutionFailure failure;
            Symbols.Container baseReference = new Symbols.Container(Instance);
            if (baseReference.IsArray)
            {
                return(ArgumentNames.Length == 0);
            }
            string       memberName  = "";
            BindingFlags setProperty = BindingFlags.SetProperty;

            MemberInfo[] members = baseReference.GetMembers(ref memberName, false);
            if ((members == null) || (members.Length == 0))
            {
                return(false);
            }
            Symbols.Method method = ResolveCall(baseReference, memberName, members, Arguments, ArgumentNames, Symbols.NoTypeArguments, setProperty, false, ref failure);
            if (failure != OverloadResolution.ResolutionFailure.None)
            {
                return(OptimisticSet);
            }
            if (RValueBase && baseReference.IsValueType)
            {
                return(false);
            }
            return(true);
        }
Example #4
0
 internal static object InternalLateIndexGet(object Instance, object[] Arguments, string[] ArgumentNames, bool ReportErrors, ref OverloadResolution.ResolutionFailure Failure)
 {
     Failure = OverloadResolution.ResolutionFailure.None;
     if (Arguments == null)
     {
         Arguments = Symbols.NoArguments;
     }
     if (ArgumentNames == null)
     {
         ArgumentNames = Symbols.NoArgumentNames;
     }
     Symbols.Container baseReference = new Symbols.Container(Instance);
     if (baseReference.IsCOMObject)
     {
         throw new InvalidOperationException("Never expected to see a COM object in Telesto");
     }
     if (!baseReference.IsArray)
     {
         return(CallMethod(baseReference, "", Arguments, ArgumentNames, Symbols.NoTypeArguments, null, BindingFlags.GetProperty | BindingFlags.InvokeMethod, ReportErrors, ref Failure));
     }
     if (ArgumentNames.Length <= 0)
     {
         return(baseReference.GetArrayValue(Arguments));
     }
     Failure = OverloadResolution.ResolutionFailure.InvalidArgument;
     if (ReportErrors)
     {
         throw new ArgumentException(Utils.GetResourceString("Argument_InvalidNamedArgs"));
     }
     return(null);
 }
Example #5
0
 private static object InternalLateIndexGet(object Instance, object[] Arguments, string[] ArgumentNames, bool ReportErrors, ref OverloadResolution.ResolutionFailure Failure, bool[] CopyBack)
 {
     Failure = OverloadResolution.ResolutionFailure.None;
     if (Arguments == null)
     {
         Arguments = Symbols.NoArguments;
     }
     if (ArgumentNames == null)
     {
         ArgumentNames = Symbols.NoArgumentNames;
     }
     Symbols.Container baseReference = new Symbols.Container(Instance);
     if (baseReference.IsCOMObject)
     {
         return(LateBinding.LateIndexGet(Instance, Arguments, ArgumentNames));
     }
     if (!baseReference.IsArray)
     {
         return(CallMethod(baseReference, "", Arguments, ArgumentNames, Symbols.NoTypeArguments, CopyBack, BindingFlags.GetProperty | BindingFlags.InvokeMethod, ReportErrors, ref Failure));
     }
     if (ArgumentNames.Length > 0)
     {
         Failure = OverloadResolution.ResolutionFailure.InvalidArgument;
         if (ReportErrors)
         {
             throw new ArgumentException(Utils.GetResourceString("Argument_InvalidNamedArgs"));
         }
         return(null);
     }
     ResetCopyback(CopyBack);
     return(baseReference.GetArrayValue(Arguments));
 }
Example #6
0
 public static bool LateCanEvaluate(object instance, Type type, string memberName, object[] arguments, bool allowFunctionEvaluation, bool allowPropertyEvaluation)
 {
     Symbols.Container container;
     if (type != null)
     {
         container = new Symbols.Container(type);
     }
     else
     {
         container = new Symbols.Container(instance);
     }
     MemberInfo[] members = container.GetMembers(ref memberName, false);
     if (members.Length != 0)
     {
         if (members[0].MemberType == MemberTypes.Field)
         {
             if (arguments.Length == 0)
             {
                 return(true);
             }
             container = new Symbols.Container(container.GetFieldValue((FieldInfo)members[0]));
             return(container.IsArray || allowPropertyEvaluation);
         }
         if (members[0].MemberType == MemberTypes.Method)
         {
             return(allowFunctionEvaluation);
         }
         if (members[0].MemberType == MemberTypes.Property)
         {
             return(allowPropertyEvaluation);
         }
     }
     return(true);
 }
Example #7
0
        public static object LateGet(object Instance, Type Type, string MemberName, object[] Arguments, string[] ArgumentNames, Type[] TypeArguments, bool[] CopyBack)
        {
            Symbols.Container container;
            if (Arguments == null)
            {
                Arguments = Symbols.NoArguments;
            }
            if (ArgumentNames == null)
            {
                ArgumentNames = Symbols.NoArgumentNames;
            }
            if (TypeArguments == null)
            {
                TypeArguments = Symbols.NoTypeArguments;
            }
            if (Type != null)
            {
                container = new Symbols.Container(Type);
            }
            else
            {
                container = new Symbols.Container(Instance);
            }
            if (container.IsCOMObject)
            {
                return(LateBinding.LateGet(Instance, Type, MemberName, Arguments, ArgumentNames, CopyBack));
            }
            IDynamicMetaObjectProvider instance = IDOUtils.TryCastToIDMOP(Instance);

            if ((instance != null) && (TypeArguments == Symbols.NoTypeArguments))
            {
                return(IDOBinder.IDOGet(instance, MemberName, Arguments, ArgumentNames, CopyBack));
            }
            return(ObjectLateGet(Instance, Type, MemberName, Arguments, ArgumentNames, TypeArguments, CopyBack));
        }
Example #8
0
        private static object ObjectLateGet(object Instance, Type Type, string MemberName, object[] Arguments, string[] ArgumentNames, Type[] TypeArguments, bool[] CopyBack)
        {
            Symbols.Container container;
            OverloadResolution.ResolutionFailure failure;
            if (Type != null)
            {
                container = new Symbols.Container(Type);
            }
            else
            {
                container = new Symbols.Container(Instance);
            }
            BindingFlags lookupFlags = BindingFlags.GetProperty | BindingFlags.InvokeMethod;

            MemberInfo[] members = container.GetMembers(ref MemberName, true);
            if (members[0].MemberType == MemberTypes.Field)
            {
                if (TypeArguments.Length > 0)
                {
                    throw new ArgumentException(Utils.GetResourceString("Argument_InvalidValue"));
                }
                object fieldValue = container.GetFieldValue((FieldInfo)members[0]);
                if (Arguments.Length == 0)
                {
                    return(fieldValue);
                }
                return(LateIndexGet(fieldValue, Arguments, ArgumentNames, CopyBack));
            }
            if ((ArgumentNames.Length > Arguments.Length) || ((CopyBack != null) && (CopyBack.Length != Arguments.Length)))
            {
                throw new ArgumentException(Utils.GetResourceString("Argument_InvalidValue"));
            }
            Symbols.Method targetProcedure = ResolveCall(container, MemberName, members, Arguments, ArgumentNames, TypeArguments, lookupFlags, false, ref failure);
            if (failure == OverloadResolution.ResolutionFailure.None)
            {
                return(container.InvokeMethod(targetProcedure, Arguments, CopyBack, lookupFlags));
            }
            if (((Arguments.Length > 0) && (members.Length == 1)) && IsZeroArgumentCall(members[0]))
            {
                targetProcedure = ResolveCall(container, MemberName, members, Symbols.NoArguments, Symbols.NoArgumentNames, TypeArguments, lookupFlags, false, ref failure);
                if (failure == OverloadResolution.ResolutionFailure.None)
                {
                    object instance = container.InvokeMethod(targetProcedure, Symbols.NoArguments, null, lookupFlags);
                    if (instance == null)
                    {
                        throw new MissingMemberException(Utils.GetResourceString("IntermediateLateBoundNothingResult1", new string[] { targetProcedure.ToString(), container.VBFriendlyName }));
                    }
                    instance = InternalLateIndexGet(instance, Arguments, ArgumentNames, false, ref failure, CopyBack);
                    if (failure == OverloadResolution.ResolutionFailure.None)
                    {
                        return(instance);
                    }
                }
            }
            ResolveCall(container, MemberName, members, Arguments, ArgumentNames, TypeArguments, lookupFlags, true, ref failure);
            throw new InternalErrorException();
        }
Example #9
0
 internal static void ObjectLateIndexSetComplex(object Instance, object[] Arguments, string[] ArgumentNames, bool OptimisticSet, bool RValueBase)
 {
     if (Arguments == null)
     {
         Arguments = Symbols.NoArguments;
     }
     if (ArgumentNames == null)
     {
         ArgumentNames = Symbols.NoArgumentNames;
     }
     Symbols.Container baseReference = new Symbols.Container(Instance);
     if (baseReference.IsArray)
     {
         if (ArgumentNames.Length > 0)
         {
             throw new ArgumentException(Utils.GetResourceString("Argument_InvalidNamedArgs"));
         }
         baseReference.SetArrayValue(Arguments);
     }
     else
     {
         if (ArgumentNames.Length > Arguments.Length)
         {
             throw new ArgumentException(Utils.GetResourceString("Argument_InvalidValue"));
         }
         if (Arguments.Length < 1)
         {
             throw new ArgumentException(Utils.GetResourceString("Argument_InvalidValue"));
         }
         string memberName = "";
         if (baseReference.IsCOMObject)
         {
             LateBinding.LateIndexSetComplex(Instance, Arguments, ArgumentNames, OptimisticSet, RValueBase);
         }
         else
         {
             OverloadResolution.ResolutionFailure failure;
             BindingFlags   setProperty     = BindingFlags.SetProperty;
             MemberInfo[]   members         = baseReference.GetMembers(ref memberName, true);
             Symbols.Method targetProcedure = ResolveCall(baseReference, memberName, members, Arguments, ArgumentNames, Symbols.NoTypeArguments, setProperty, false, ref failure);
             if (failure == OverloadResolution.ResolutionFailure.None)
             {
                 if (RValueBase && baseReference.IsValueType)
                 {
                     throw new Exception(Utils.GetResourceString("RValueBaseForValueType", new string[] { baseReference.VBFriendlyName, baseReference.VBFriendlyName }));
                 }
                 baseReference.InvokeMethod(targetProcedure, Arguments, null, setProperty);
             }
             else if (!OptimisticSet)
             {
                 ResolveCall(baseReference, memberName, members, Arguments, ArgumentNames, Symbols.NoTypeArguments, setProperty, true, ref failure);
                 throw new InternalErrorException();
             }
         }
     }
 }
Example #10
0
        private static object ObjectLateInvokeDefault(object Instance, object[] Arguments, string[] ArgumentNames, bool ReportErrors, bool[] CopyBack)
        {
            OverloadResolution.ResolutionFailure failure;
            Symbols.Container container = new Symbols.Container(Instance);
            object            obj3      = InternalLateIndexGet(Instance, Arguments, ArgumentNames, (ReportErrors || (Arguments.Length != 0)) || container.IsArray, ref failure, CopyBack);

            if (failure != OverloadResolution.ResolutionFailure.None)
            {
                return(Instance);
            }
            return(obj3);
        }
Example #11
0
 internal static bool CanBindInvokeDefault(object Instance, object[] Arguments, string[] ArgumentNames, bool ReportErrors)
 {
     Symbols.Container container = new Symbols.Container(Instance);
     ReportErrors = (ReportErrors || (Arguments.Length != 0)) || container.IsArray;
     if (!ReportErrors)
     {
         return(true);
     }
     if (container.IsArray)
     {
         return(ArgumentNames.Length == 0);
     }
     return(CanBindCall(Instance, "", Arguments, ArgumentNames, false));
 }
 internal static bool CanBindCall(object Instance, string MemberName, object[] Arguments, string[] ArgumentNames, bool IgnoreReturn)
 {
     OverloadResolution.ResolutionFailure failure;
     Symbols.Container baseReference = new Symbols.Container(Instance);
     BindingFlags lookupFlags = BindingFlags.GetProperty | BindingFlags.InvokeMethod;
     if (IgnoreReturn)
     {
         lookupFlags |= BindingFlags.IgnoreReturn;
     }
     MemberInfo[] members = baseReference.GetMembers(ref MemberName, false);
     if ((members == null) || (members.Length == 0))
     {
         return false;
     }
     Symbols.Method method = ResolveCall(baseReference, MemberName, members, Arguments, ArgumentNames, Symbols.NoTypeArguments, lookupFlags, false, ref failure);
     return (failure == OverloadResolution.ResolutionFailure.None);
 }
Example #13
0
        internal static bool CanBindCall(object Instance, string MemberName, object[] Arguments, string[] ArgumentNames, bool IgnoreReturn)
        {
            OverloadResolution.ResolutionFailure failure;
            Symbols.Container baseReference = new Symbols.Container(Instance);
            BindingFlags      lookupFlags   = BindingFlags.GetProperty | BindingFlags.InvokeMethod;

            if (IgnoreReturn)
            {
                lookupFlags |= BindingFlags.IgnoreReturn;
            }
            MemberInfo[] members = baseReference.GetMembers(ref MemberName, false);
            if ((members == null) || (members.Length == 0))
            {
                return(false);
            }
            Symbols.Method method = ResolveCall(baseReference, MemberName, members, Arguments, ArgumentNames, Symbols.NoTypeArguments, lookupFlags, false, ref failure);
            return(failure == OverloadResolution.ResolutionFailure.None);
        }
Example #14
0
        private static object ObjectLateCall(object Instance, Type Type, string MemberName, object[] Arguments, string[] ArgumentNames, Type[] TypeArguments, bool[] CopyBack, bool IgnoreReturn)
        {
            Symbols.Container container;
            OverloadResolution.ResolutionFailure failure;
            if (Type != null)
            {
                container = new Symbols.Container(Type);
            }
            else
            {
                container = new Symbols.Container(Instance);
            }
            BindingFlags invocationFlags = BindingFlags.GetProperty | BindingFlags.InvokeMethod;

            if (IgnoreReturn)
            {
                invocationFlags |= BindingFlags.IgnoreReturn;
            }
            return(CallMethod(container, MemberName, Arguments, ArgumentNames, TypeArguments, CopyBack, invocationFlags, true, ref failure));
        }
Example #15
0
        internal static bool CanBindSet(object Instance, string MemberName, object Value, bool OptimisticSet, bool RValueBase)
        {
            OverloadResolution.ResolutionFailure failure;
            Symbols.Container baseReference = new Symbols.Container(Instance);
            object[]          arguments     = new object[] { Value };
            MemberInfo[]      members       = baseReference.GetMembers(ref MemberName, false);
            if ((members == null) || (members.Length == 0))
            {
                return(false);
            }
            if (members[0].MemberType == MemberTypes.Field)
            {
                if (((arguments.Length == 1) && RValueBase) && baseReference.IsValueType)
                {
                    return(false);
                }
                return(true);
            }
            Symbols.Method method = ResolveCall(baseReference, MemberName, members, arguments, Symbols.NoArgumentNames, Symbols.NoTypeArguments, BindingFlags.SetProperty, false, ref failure);
            if (failure == OverloadResolution.ResolutionFailure.None)
            {
                if (RValueBase && baseReference.IsValueType)
                {
                    return(false);
                }
                return(true);
            }
            BindingFlags lookupFlags = BindingFlags.GetProperty | BindingFlags.InvokeMethod;

            if (failure == OverloadResolution.ResolutionFailure.MissingMember)
            {
                method = ResolveCall(baseReference, MemberName, members, Symbols.NoArguments, Symbols.NoArgumentNames, Symbols.NoTypeArguments, lookupFlags, false, ref failure);
                if (failure == OverloadResolution.ResolutionFailure.None)
                {
                    return(true);
                }
            }
            return(OptimisticSet);
        }
Example #16
0
 private static object CallMethod(Symbols.Container BaseReference, string MethodName, object[] Arguments, string[] ArgumentNames, Type[] TypeArguments, bool[] CopyBack, BindingFlags InvocationFlags, bool ReportErrors, ref OverloadResolution.ResolutionFailure Failure)
 {
     Failure = OverloadResolution.ResolutionFailure.None;
     if ((ArgumentNames.Length > Arguments.Length) || ((CopyBack != null) && (CopyBack.Length != Arguments.Length)))
     {
         Failure = OverloadResolution.ResolutionFailure.InvalidArgument;
         if (ReportErrors)
         {
             throw new ArgumentException(Utils.GetResourceString("Argument_InvalidValue"));
         }
         return(null);
     }
     if (Symbols.HasFlag(InvocationFlags, BindingFlags.SetProperty) && (Arguments.Length < 1))
     {
         Failure = OverloadResolution.ResolutionFailure.InvalidArgument;
         if (ReportErrors)
         {
             throw new ArgumentException(Utils.GetResourceString("Argument_InvalidValue"));
         }
         return(null);
     }
     MemberInfo[] members = BaseReference.GetMembers(ref MethodName, ReportErrors);
     if ((members == null) || (members.Length == 0))
     {
         Failure = OverloadResolution.ResolutionFailure.MissingMember;
         if (ReportErrors)
         {
             members = BaseReference.GetMembers(ref MethodName, true);
         }
         return(null);
     }
     Symbols.Method targetProcedure = ResolveCall(BaseReference, MethodName, members, Arguments, ArgumentNames, TypeArguments, InvocationFlags, ReportErrors, ref Failure);
     if (Failure == OverloadResolution.ResolutionFailure.None)
     {
         return(BaseReference.InvokeMethod(targetProcedure, Arguments, CopyBack, InvocationFlags));
     }
     return(null);
 }
Example #17
0
        public static object LateCall(object Instance, Type Type, string MemberName, object[] Arguments, string[] ArgumentNames, Type[] TypeArguments, bool[] CopyBack, bool IgnoreReturn)
        {
            Symbols.Container container;
            OverloadResolution.ResolutionFailure failure = 0;
            if (Arguments == null)
            {
                Arguments = Symbols.NoArguments;
            }
            if (ArgumentNames == null)
            {
                ArgumentNames = Symbols.NoArgumentNames;
            }
            if (TypeArguments == null)
            {
                TypeArguments = Symbols.NoTypeArguments;
            }
            if (Type != null)
            {
                container = new Symbols.Container(Type);
            }
            else
            {
                container = new Symbols.Container(Instance);
            }
            if (container.IsCOMObject)
            {
                throw new InvalidOperationException("Never expected to see a COM object in Telesto");
            }
            BindingFlags invocationFlags = BindingFlags.GetProperty | BindingFlags.InvokeMethod;

            if (IgnoreReturn)
            {
                invocationFlags |= BindingFlags.IgnoreReturn;
            }
            return(CallMethod(container, MemberName, Arguments, ArgumentNames, TypeArguments, CopyBack, invocationFlags, true, ref failure));
        }
Example #18
0
 public static void LateSet(object Instance, Type Type, string MemberName, object[] Arguments, string[] ArgumentNames, Type[] TypeArguments, bool OptimisticSet, bool RValueBase, CallType CallType)
 {
     Symbols.Container container;
     if (Arguments == null)
     {
         Arguments = Symbols.NoArguments;
     }
     if (ArgumentNames == null)
     {
         ArgumentNames = Symbols.NoArgumentNames;
     }
     if (TypeArguments == null)
     {
         TypeArguments = Symbols.NoTypeArguments;
     }
     if (Type != null)
     {
         container = new Symbols.Container(Type);
     }
     else
     {
         container = new Symbols.Container(Instance);
     }
     if (container.IsCOMObject)
     {
         try
         {
             LateBinding.InternalLateSet(Instance, ref Type, MemberName, Arguments, ArgumentNames, OptimisticSet, CallType);
             if (RValueBase && Type.IsValueType)
             {
                 throw new Exception(Utils.GetResourceString("RValueBaseForValueType", new string[] { Utils.VBFriendlyName(Type, Instance), Utils.VBFriendlyName(Type, Instance) }));
             }
         }
         catch when(?)
         {
         }
     }
     else
     {
         MemberInfo[] members = container.GetMembers(ref MemberName, true);
         if (members[0].MemberType == MemberTypes.Field)
         {
             if (TypeArguments.Length > 0)
             {
                 throw new ArgumentException(Utils.GetResourceString("Argument_InvalidValue"));
             }
             if (Arguments.Length == 1)
             {
                 if (RValueBase && container.IsValueType)
                 {
                     throw new Exception(Utils.GetResourceString("RValueBaseForValueType", new string[] { container.VBFriendlyName, container.VBFriendlyName }));
                 }
                 container.SetFieldValue((FieldInfo)members[0], Arguments[0]);
             }
             else
             {
                 LateIndexSetComplex(container.GetFieldValue((FieldInfo)members[0]), Arguments, ArgumentNames, OptimisticSet, true);
             }
         }
         else
         {
             OverloadResolution.ResolutionFailure failure;
             Symbols.Method method;
             BindingFlags   setProperty = BindingFlags.SetProperty;
             if (ArgumentNames.Length > Arguments.Length)
             {
                 throw new ArgumentException(Utils.GetResourceString("Argument_InvalidValue"));
             }
             if (TypeArguments.Length == 0)
             {
                 method = ResolveCall(container, MemberName, members, Arguments, ArgumentNames, Symbols.NoTypeArguments, setProperty, false, ref failure);
                 if (failure == OverloadResolution.ResolutionFailure.None)
                 {
                     if (RValueBase && container.IsValueType)
                     {
                         throw new Exception(Utils.GetResourceString("RValueBaseForValueType", new string[] { container.VBFriendlyName, container.VBFriendlyName }));
                     }
                     container.InvokeMethod(method, Arguments, null, setProperty);
                     return;
                 }
             }
             BindingFlags lookupFlags = BindingFlags.GetProperty | BindingFlags.InvokeMethod;
             switch (failure)
             {
             case OverloadResolution.ResolutionFailure.None:
             case OverloadResolution.ResolutionFailure.MissingMember:
                 method = ResolveCall(container, MemberName, members, Symbols.NoArguments, Symbols.NoArgumentNames, TypeArguments, lookupFlags, false, ref failure);
                 if (failure == OverloadResolution.ResolutionFailure.None)
                 {
                     object instance = container.InvokeMethod(method, Symbols.NoArguments, null, lookupFlags);
                     if (instance == null)
                     {
                         throw new MissingMemberException(Utils.GetResourceString("IntermediateLateBoundNothingResult1", new string[] { method.ToString(), container.VBFriendlyName }));
                     }
                     LateIndexSetComplex(instance, Arguments, ArgumentNames, OptimisticSet, true);
                     return;
                 }
                 break;
             }
             if (!OptimisticSet)
             {
                 if (TypeArguments.Length == 0)
                 {
                     ResolveCall(container, MemberName, members, Arguments, ArgumentNames, TypeArguments, setProperty, true, ref failure);
                 }
                 else
                 {
                     ResolveCall(container, MemberName, members, Symbols.NoArguments, Symbols.NoArgumentNames, TypeArguments, lookupFlags, true, ref failure);
                 }
                 throw new InternalErrorException();
             }
         }
     }
 }
 internal static bool CanBindInvokeDefault(object Instance, object[] Arguments, string[] ArgumentNames, bool ReportErrors)
 {
     Symbols.Container container = new Symbols.Container(Instance);
     ReportErrors = (ReportErrors || (Arguments.Length != 0)) || container.IsArray;
     if (!ReportErrors)
     {
         return true;
     }
     if (container.IsArray)
     {
         return (ArgumentNames.Length == 0);
     }
     return CanBindCall(Instance, "", Arguments, ArgumentNames, false);
 }
 internal static bool CanBindSet(object Instance, string MemberName, object Value, bool OptimisticSet, bool RValueBase)
 {
     OverloadResolution.ResolutionFailure failure;
     Symbols.Container baseReference = new Symbols.Container(Instance);
     object[] arguments = new object[] { Value };
     MemberInfo[] members = baseReference.GetMembers(ref MemberName, false);
     if ((members == null) || (members.Length == 0))
     {
         return false;
     }
     if (members[0].MemberType == MemberTypes.Field)
     {
         if (((arguments.Length == 1) && RValueBase) && baseReference.IsValueType)
         {
             return false;
         }
         return true;
     }
     Symbols.Method method = ResolveCall(baseReference, MemberName, members, arguments, Symbols.NoArgumentNames, Symbols.NoTypeArguments, BindingFlags.SetProperty, false, ref failure);
     if (failure == OverloadResolution.ResolutionFailure.None)
     {
         if (RValueBase && baseReference.IsValueType)
         {
             return false;
         }
         return true;
     }
     BindingFlags lookupFlags = BindingFlags.GetProperty | BindingFlags.InvokeMethod;
     if (failure == OverloadResolution.ResolutionFailure.MissingMember)
     {
         method = ResolveCall(baseReference, MemberName, members, Symbols.NoArguments, Symbols.NoArgumentNames, Symbols.NoTypeArguments, lookupFlags, false, ref failure);
         if (failure == OverloadResolution.ResolutionFailure.None)
         {
             return true;
         }
     }
     return OptimisticSet;
 }
 internal static bool CanIndexSetComplex(object Instance, object[] Arguments, string[] ArgumentNames, bool OptimisticSet, bool RValueBase)
 {
     OverloadResolution.ResolutionFailure failure;
     Symbols.Container baseReference = new Symbols.Container(Instance);
     if (baseReference.IsArray)
     {
         return (ArgumentNames.Length == 0);
     }
     string memberName = "";
     BindingFlags setProperty = BindingFlags.SetProperty;
     MemberInfo[] members = baseReference.GetMembers(ref memberName, false);
     if ((members == null) || (members.Length == 0))
     {
         return false;
     }
     Symbols.Method method = ResolveCall(baseReference, memberName, members, Arguments, ArgumentNames, Symbols.NoTypeArguments, setProperty, false, ref failure);
     if (failure != OverloadResolution.ResolutionFailure.None)
     {
         return OptimisticSet;
     }
     if (RValueBase && baseReference.IsValueType)
     {
         return false;
     }
     return true;
 }
 public static bool LateCanEvaluate(object instance, Type type, string memberName, object[] arguments, bool allowFunctionEvaluation, bool allowPropertyEvaluation)
 {
     Symbols.Container container;
     if (type != null)
     {
         container = new Symbols.Container(type);
     }
     else
     {
         container = new Symbols.Container(instance);
     }
     MemberInfo[] members = container.GetMembers(ref memberName, false);
     if (members.Length != 0)
     {
         if (members[0].MemberType == MemberTypes.Field)
         {
             if (arguments.Length == 0)
             {
                 return true;
             }
             container = new Symbols.Container(container.GetFieldValue((FieldInfo) members[0]));
             return (container.IsArray || allowPropertyEvaluation);
         }
         if (members[0].MemberType == MemberTypes.Method)
         {
             return allowFunctionEvaluation;
         }
         if (members[0].MemberType == MemberTypes.Property)
         {
             return allowPropertyEvaluation;
         }
     }
     return true;
 }
 public static object LateGet(object Instance, Type Type, string MemberName, object[] Arguments, string[] ArgumentNames, Type[] TypeArguments, bool[] CopyBack)
 {
     Symbols.Container container;
     if (Arguments == null)
     {
         Arguments = Symbols.NoArguments;
     }
     if (ArgumentNames == null)
     {
         ArgumentNames = Symbols.NoArgumentNames;
     }
     if (TypeArguments == null)
     {
         TypeArguments = Symbols.NoTypeArguments;
     }
     if (Type != null)
     {
         container = new Symbols.Container(Type);
     }
     else
     {
         container = new Symbols.Container(Instance);
     }
     if (container.IsCOMObject)
     {
         return LateBinding.LateGet(Instance, Type, MemberName, Arguments, ArgumentNames, CopyBack);
     }
     IDynamicMetaObjectProvider instance = IDOUtils.TryCastToIDMOP(Instance);
     if ((instance != null) && (TypeArguments == Symbols.NoTypeArguments))
     {
         return IDOBinder.IDOGet(instance, MemberName, Arguments, ArgumentNames, CopyBack);
     }
     return ObjectLateGet(Instance, Type, MemberName, Arguments, ArgumentNames, TypeArguments, CopyBack);
 }
 internal static void ObjectLateIndexSetComplex(object Instance, object[] Arguments, string[] ArgumentNames, bool OptimisticSet, bool RValueBase)
 {
     if (Arguments == null)
     {
         Arguments = Symbols.NoArguments;
     }
     if (ArgumentNames == null)
     {
         ArgumentNames = Symbols.NoArgumentNames;
     }
     Symbols.Container baseReference = new Symbols.Container(Instance);
     if (baseReference.IsArray)
     {
         if (ArgumentNames.Length > 0)
         {
             throw new ArgumentException(Utils.GetResourceString("Argument_InvalidNamedArgs"));
         }
         baseReference.SetArrayValue(Arguments);
     }
     else
     {
         if (ArgumentNames.Length > Arguments.Length)
         {
             throw new ArgumentException(Utils.GetResourceString("Argument_InvalidValue"));
         }
         if (Arguments.Length < 1)
         {
             throw new ArgumentException(Utils.GetResourceString("Argument_InvalidValue"));
         }
         string memberName = "";
         if (baseReference.IsCOMObject)
         {
             LateBinding.LateIndexSetComplex(Instance, Arguments, ArgumentNames, OptimisticSet, RValueBase);
         }
         else
         {
             OverloadResolution.ResolutionFailure failure;
             BindingFlags setProperty = BindingFlags.SetProperty;
             MemberInfo[] members = baseReference.GetMembers(ref memberName, true);
             Symbols.Method targetProcedure = ResolveCall(baseReference, memberName, members, Arguments, ArgumentNames, Symbols.NoTypeArguments, setProperty, false, ref failure);
             if (failure == OverloadResolution.ResolutionFailure.None)
             {
                 if (RValueBase && baseReference.IsValueType)
                 {
                     throw new Exception(Utils.GetResourceString("RValueBaseForValueType", new string[] { baseReference.VBFriendlyName, baseReference.VBFriendlyName }));
                 }
                 baseReference.InvokeMethod(targetProcedure, Arguments, null, setProperty);
             }
             else if (!OptimisticSet)
             {
                 ResolveCall(baseReference, memberName, members, Arguments, ArgumentNames, Symbols.NoTypeArguments, setProperty, true, ref failure);
                 throw new InternalErrorException();
             }
         }
     }
 }
 private static object ObjectLateGet(object Instance, Type Type, string MemberName, object[] Arguments, string[] ArgumentNames, Type[] TypeArguments, bool[] CopyBack)
 {
     Symbols.Container container;
     OverloadResolution.ResolutionFailure failure;
     if (Type != null)
     {
         container = new Symbols.Container(Type);
     }
     else
     {
         container = new Symbols.Container(Instance);
     }
     BindingFlags lookupFlags = BindingFlags.GetProperty | BindingFlags.InvokeMethod;
     MemberInfo[] members = container.GetMembers(ref MemberName, true);
     if (members[0].MemberType == MemberTypes.Field)
     {
         if (TypeArguments.Length > 0)
         {
             throw new ArgumentException(Utils.GetResourceString("Argument_InvalidValue"));
         }
         object fieldValue = container.GetFieldValue((FieldInfo) members[0]);
         if (Arguments.Length == 0)
         {
             return fieldValue;
         }
         return LateIndexGet(fieldValue, Arguments, ArgumentNames, CopyBack);
     }
     if ((ArgumentNames.Length > Arguments.Length) || ((CopyBack != null) && (CopyBack.Length != Arguments.Length)))
     {
         throw new ArgumentException(Utils.GetResourceString("Argument_InvalidValue"));
     }
     Symbols.Method targetProcedure = ResolveCall(container, MemberName, members, Arguments, ArgumentNames, TypeArguments, lookupFlags, false, ref failure);
     if (failure == OverloadResolution.ResolutionFailure.None)
     {
         return container.InvokeMethod(targetProcedure, Arguments, CopyBack, lookupFlags);
     }
     if (((Arguments.Length > 0) && (members.Length == 1)) && IsZeroArgumentCall(members[0]))
     {
         targetProcedure = ResolveCall(container, MemberName, members, Symbols.NoArguments, Symbols.NoArgumentNames, TypeArguments, lookupFlags, false, ref failure);
         if (failure == OverloadResolution.ResolutionFailure.None)
         {
             object instance = container.InvokeMethod(targetProcedure, Symbols.NoArguments, null, lookupFlags);
             if (instance == null)
             {
                 throw new MissingMemberException(Utils.GetResourceString("IntermediateLateBoundNothingResult1", new string[] { targetProcedure.ToString(), container.VBFriendlyName }));
             }
             instance = InternalLateIndexGet(instance, Arguments, ArgumentNames, false, ref failure, CopyBack);
             if (failure == OverloadResolution.ResolutionFailure.None)
             {
                 return instance;
             }
         }
     }
     ResolveCall(container, MemberName, members, Arguments, ArgumentNames, TypeArguments, lookupFlags, true, ref failure);
     throw new InternalErrorException();
 }
 private static object ObjectLateCall(object Instance, Type Type, string MemberName, object[] Arguments, string[] ArgumentNames, Type[] TypeArguments, bool[] CopyBack, bool IgnoreReturn)
 {
     Symbols.Container container;
     OverloadResolution.ResolutionFailure failure;
     if (Type != null)
     {
         container = new Symbols.Container(Type);
     }
     else
     {
         container = new Symbols.Container(Instance);
     }
     BindingFlags invocationFlags = BindingFlags.GetProperty | BindingFlags.InvokeMethod;
     if (IgnoreReturn)
     {
         invocationFlags |= BindingFlags.IgnoreReturn;
     }
     return CallMethod(container, MemberName, Arguments, ArgumentNames, TypeArguments, CopyBack, invocationFlags, true, ref failure);
 }
 private static object InternalLateIndexGet(object Instance, object[] Arguments, string[] ArgumentNames, bool ReportErrors, ref OverloadResolution.ResolutionFailure Failure, bool[] CopyBack)
 {
     Failure = OverloadResolution.ResolutionFailure.None;
     if (Arguments == null)
     {
         Arguments = Symbols.NoArguments;
     }
     if (ArgumentNames == null)
     {
         ArgumentNames = Symbols.NoArgumentNames;
     }
     Symbols.Container baseReference = new Symbols.Container(Instance);
     if (baseReference.IsCOMObject)
     {
         return LateBinding.LateIndexGet(Instance, Arguments, ArgumentNames);
     }
     if (!baseReference.IsArray)
     {
         return CallMethod(baseReference, "", Arguments, ArgumentNames, Symbols.NoTypeArguments, CopyBack, BindingFlags.GetProperty | BindingFlags.InvokeMethod, ReportErrors, ref Failure);
     }
     if (ArgumentNames.Length > 0)
     {
         Failure = OverloadResolution.ResolutionFailure.InvalidArgument;
         if (ReportErrors)
         {
             throw new ArgumentException(Utils.GetResourceString("Argument_InvalidNamedArgs"));
         }
         return null;
     }
     ResetCopyback(CopyBack);
     return baseReference.GetArrayValue(Arguments);
 }
 public static void LateSet(object Instance, Type Type, string MemberName, object[] Arguments, string[] ArgumentNames, Type[] TypeArguments, bool OptimisticSet, bool RValueBase, CallType CallType)
 {
     Symbols.Container container;
     if (Arguments == null)
     {
         Arguments = Symbols.NoArguments;
     }
     if (ArgumentNames == null)
     {
         ArgumentNames = Symbols.NoArgumentNames;
     }
     if (TypeArguments == null)
     {
         TypeArguments = Symbols.NoTypeArguments;
     }
     if (Type != null)
     {
         container = new Symbols.Container(Type);
     }
     else
     {
         container = new Symbols.Container(Instance);
     }
     if (container.IsCOMObject)
     {
         try
         {
             LateBinding.InternalLateSet(Instance, ref Type, MemberName, Arguments, ArgumentNames, OptimisticSet, CallType);
             if (RValueBase && Type.IsValueType)
             {
                 throw new Exception(Utils.GetResourceString("RValueBaseForValueType", new string[] { Utils.VBFriendlyName(Type, Instance), Utils.VBFriendlyName(Type, Instance) }));
             }
         }
         catch when (?)
         {
         }
     }
     else
     {
         MemberInfo[] members = container.GetMembers(ref MemberName, true);
         if (members[0].MemberType == MemberTypes.Field)
         {
             if (TypeArguments.Length > 0)
             {
                 throw new ArgumentException(Utils.GetResourceString("Argument_InvalidValue"));
             }
             if (Arguments.Length == 1)
             {
                 if (RValueBase && container.IsValueType)
                 {
                     throw new Exception(Utils.GetResourceString("RValueBaseForValueType", new string[] { container.VBFriendlyName, container.VBFriendlyName }));
                 }
                 container.SetFieldValue((FieldInfo) members[0], Arguments[0]);
             }
             else
             {
                 LateIndexSetComplex(container.GetFieldValue((FieldInfo) members[0]), Arguments, ArgumentNames, OptimisticSet, true);
             }
         }
         else
         {
             OverloadResolution.ResolutionFailure failure;
             Symbols.Method method;
             BindingFlags setProperty = BindingFlags.SetProperty;
             if (ArgumentNames.Length > Arguments.Length)
             {
                 throw new ArgumentException(Utils.GetResourceString("Argument_InvalidValue"));
             }
             if (TypeArguments.Length == 0)
             {
                 method = ResolveCall(container, MemberName, members, Arguments, ArgumentNames, Symbols.NoTypeArguments, setProperty, false, ref failure);
                 if (failure == OverloadResolution.ResolutionFailure.None)
                 {
                     if (RValueBase && container.IsValueType)
                     {
                         throw new Exception(Utils.GetResourceString("RValueBaseForValueType", new string[] { container.VBFriendlyName, container.VBFriendlyName }));
                     }
                     container.InvokeMethod(method, Arguments, null, setProperty);
                     return;
                 }
             }
             BindingFlags lookupFlags = BindingFlags.GetProperty | BindingFlags.InvokeMethod;
             switch (failure)
             {
                 case OverloadResolution.ResolutionFailure.None:
                 case OverloadResolution.ResolutionFailure.MissingMember:
                     method = ResolveCall(container, MemberName, members, Symbols.NoArguments, Symbols.NoArgumentNames, TypeArguments, lookupFlags, false, ref failure);
                     if (failure == OverloadResolution.ResolutionFailure.None)
                     {
                         object instance = container.InvokeMethod(method, Symbols.NoArguments, null, lookupFlags);
                         if (instance == null)
                         {
                             throw new MissingMemberException(Utils.GetResourceString("IntermediateLateBoundNothingResult1", new string[] { method.ToString(), container.VBFriendlyName }));
                         }
                         LateIndexSetComplex(instance, Arguments, ArgumentNames, OptimisticSet, true);
                         return;
                     }
                     break;
             }
             if (!OptimisticSet)
             {
                 if (TypeArguments.Length == 0)
                 {
                     ResolveCall(container, MemberName, members, Arguments, ArgumentNames, TypeArguments, setProperty, true, ref failure);
                 }
                 else
                 {
                     ResolveCall(container, MemberName, members, Symbols.NoArguments, Symbols.NoArgumentNames, TypeArguments, lookupFlags, true, ref failure);
                 }
                 throw new InternalErrorException();
             }
         }
     }
 }
 private static object ObjectLateInvokeDefault(object Instance, object[] Arguments, string[] ArgumentNames, bool ReportErrors, bool[] CopyBack)
 {
     OverloadResolution.ResolutionFailure failure;
     Symbols.Container container = new Symbols.Container(Instance);
     object obj3 = InternalLateIndexGet(Instance, Arguments, ArgumentNames, (ReportErrors || (Arguments.Length != 0)) || container.IsArray, ref failure, CopyBack);
     if (failure != OverloadResolution.ResolutionFailure.None)
     {
         return Instance;
     }
     return obj3;
 }
 internal static object InvokeUserDefinedOperator(Symbols.Method OperatorMethod, bool ForceArgumentValidation, params object[] Arguments)
 {
     if ((!OperatorMethod.ArgumentsValidated || ForceArgumentValidation) && !OverloadResolution.CanMatchArguments(OperatorMethod, Arguments, Symbols.NoArgumentNames, Symbols.NoTypeArguments, false, null))
     {
         string str = "";
         List<string> errors = new List<string>();
         bool flag = OverloadResolution.CanMatchArguments(OperatorMethod, Arguments, Symbols.NoArgumentNames, Symbols.NoTypeArguments, false, errors);
         foreach (string str2 in errors)
         {
             str = str + "\r\n    " + str2;
         }
         throw new InvalidCastException(Utils.GetResourceString("MatchArgumentFailure2", new string[] { OperatorMethod.ToString(), str }));
     }
     Symbols.Container container = new Symbols.Container(OperatorMethod.DeclaringType);
     return container.InvokeMethod(OperatorMethod, Arguments, null, BindingFlags.InvokeMethod);
 }
Example #31
0
        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 List<Symbols.Method> CollectOperators(Symbols.UserDefinedOperator Op, Type Type1, Type Type2, ref bool FoundType1Operators, ref bool FoundType2Operators)
 {
     List<Symbols.Method> list2;
     int num;
     int num2;
     bool flag = Type2 != null;
     if (!Symbols.IsRootObjectType(Type1) && Symbols.IsClassOrValueType(Type1))
     {
         Symbols.Container container = new Symbols.Container(Type1);
         num = 0;
         num2 = 0;
         list2 = OverloadResolution.CollectOverloadCandidates(container.LookupNamedMembers(Symbols.OperatorCLSNames[(int) Op]), null, Interaction.IIf<int>(Symbols.IsUnaryOperator(Op), 1, 2), null, null, true, null, ref num, ref num2);
         if (list2.Count > 0)
         {
             FoundType1Operators = true;
         }
     }
     else
     {
         list2 = new List<Symbols.Method>();
     }
     if ((flag && !Symbols.IsRootObjectType(Type2)) && Symbols.IsClassOrValueType(Type2))
     {
         Type baseType = Type1;
         while (baseType != null)
         {
             if (Symbols.IsOrInheritsFrom(Type2, baseType))
             {
                 break;
             }
             baseType = baseType.BaseType;
         }
         Symbols.Container container2 = new Symbols.Container(Type2);
         num2 = 0;
         num = 0;
         List<Symbols.Method> collection = OverloadResolution.CollectOverloadCandidates(container2.LookupNamedMembers(Symbols.OperatorCLSNames[(int) Op]), null, Interaction.IIf<int>(Symbols.IsUnaryOperator(Op), 1, 2), null, null, true, baseType, ref num2, ref num);
         if (collection.Count > 0)
         {
             FoundType2Operators = true;
         }
         list2.AddRange(collection);
     }
     return list2;
 }