예제 #1
0
        ///
        /// Looks for extension method in this namespace
        ///
        public ArrayList LookupExtensionMethod(Type extensionType, ClassOrStruct currentClass, string name)
        {
            ArrayList found = null;

            if (declspaces != null)
            {
                IEnumerator e = declspaces.Values.GetEnumerator();
                e.Reset();
                while (e.MoveNext())
                {
                    Class c = e.Current as Class;
                    if (c == null)
                    {
                        continue;
                    }

                    if (!c.IsStaticClass)
                    {
                        continue;
                    }

                    ArrayList res = c.MemberCache.FindExtensionMethods(extensionType, name, c != currentClass);
                    if (res == null)
                    {
                        continue;
                    }

                    if (found == null)
                    {
                        found = res;
                    }
                    else
                    {
                        found.AddRange(res);
                    }
                }
            }

            if (external_exmethod_classes == null)
            {
                return(found);
            }

            foreach (Type t in external_exmethod_classes)
            {
                MemberCache m   = TypeHandle.GetMemberCache(t);
                ArrayList   res = m.FindExtensionMethods(extensionType, name, true);
                if (res == null)
                {
                    continue;
                }

                if (found == null)
                {
                    found = res;
                }
                else
                {
                    found.AddRange(res);
                }
            }

            return(found);
        }