// Returns the number of methods newly added to the dictionary.
        private bool AddMethodsOverwriteExisting(
            MemberInfo /*!*/[] /*!*/ newOverloads, RubyMethodGroupInfo /*!*/[] overloadOwners)
        {
            bool anyChange = false;

            for (int i = 0; i < newOverloads.Length; i++)
            {
                var method = (MethodBase)newOverloads[i];
                if (IsVisible(method))
                {
                    var paramTypes = new ValueArray <Type>(ReflectionUtils.GetParameterTypes(method.GetParameters()));
                    if (_allMethods == null)
                    {
                        _allMethods = new Dictionary <ValueArray <Type>, ClrOverloadInfo>();
                    }

                    _allMethods[paramTypes] = new ClrOverloadInfo {
                        Overload = method,
                        Owner    = (overloadOwners != null) ? overloadOwners[i] : null
                    };

                    anyChange = true;
                }
            }
            return(anyChange);
        }
Beispiel #2
0
        // Returns the number of methods newly added to the dictionary.
        private bool AddMethodsOverwriteExisting(ref Dictionary<Key<string, ValueArray<Type>>, ClrOverloadInfo> methods,
            IEnumerable<OverloadInfo/*!*/>/*!*/ newOverloads, RubyOverloadGroupInfo/*!*/[] overloadOwners, bool specialNameOnly) {

            bool anyChange = false;
            int i = 0;
            foreach (var method in newOverloads) {
                if (IsVisible(method.Attributes, method.DeclaringType, specialNameOnly)) {
                    var paramTypes = Key.Create(method.Name, new ValueArray<Type>(ReflectionUtils.GetParameterTypes(method.Parameters)));
                    if (methods == null) {
                        methods = new Dictionary<Key<string, ValueArray<Type>>, ClrOverloadInfo>();
                    }

                    methods[paramTypes] = new ClrOverloadInfo {
                        Overload = method,
                        Owner = (overloadOwners != null) ? overloadOwners[i] : null
                    };

                    anyChange = true;
                }
                i++;
            }
            return anyChange;
        }
Beispiel #3
0
        // Returns the number of methods newly added to the dictionary.
        private bool AddMethodsOverwriteExisting(ref Dictionary<Key<string, ValueArray<Type>>, ClrOverloadInfo> methods,
            MemberInfo/*!*/[]/*!*/ newOverloads, RubyOverloadGroupInfo/*!*/[] overloadOwners, bool specialNameOnly) {

            bool anyChange = false;
            for (int i = 0; i < newOverloads.Length; i++) {
                var method = (MethodBase)newOverloads[i];
                if (IsVisible(method, specialNameOnly)) {
                    var paramTypes = Key.Create(method.Name, new ValueArray<Type>(ReflectionUtils.GetParameterTypes(method.GetParameters())));
                    if (methods == null) {
                        methods = new Dictionary<Key<string, ValueArray<Type>>, ClrOverloadInfo>();
                    }

                    methods[paramTypes] = new ClrOverloadInfo {
                        Overload = method,
                        Owner = (overloadOwners != null) ? overloadOwners[i] : null
                    };

                    anyChange = true;
                }
            }
            return anyChange;
        }
        // Returns the number of methods newly added to the dictionary.
        private bool AddMethodsOverwriteExisting(
            MemberInfo/*!*/[]/*!*/ newOverloads, RubyMethodGroupInfo/*!*/[] overloadOwners) {

            bool anyChange = false;
            for (int i = 0; i < newOverloads.Length; i++) {
                var method = (MethodBase)newOverloads[i];
                if (IsVisible(method)) {
                    var paramTypes = new ValueArray<Type>(ReflectionUtils.GetParameterTypes(method.GetParameters()));
                    if (_allMethods == null) {
                        _allMethods = new Dictionary<ValueArray<Type>, ClrOverloadInfo>();
                    }

                    _allMethods[paramTypes] = new ClrOverloadInfo {
                        Overload = method,
                        Owner = (overloadOwners != null) ? overloadOwners[i] : null
                    };

                    anyChange = true;
                }
            }
            return anyChange;
        }