コード例 #1
0
        static void RemoveCircularDependencies(Type type, HashSet <Type> types)
        {
            var incTypes = types.Where(x => x != typeof(Object) &&
                                       x != typeof(ValueType) &&
                                       !IsBaseType(x, type) && !x.IsReallyEnum()).ToList();

            foreach (var subType in incTypes)
            {
                HashSet <Type> subTypes = new HashSet <Type> ();

                TypeGenerator.AddIncludes(subType, subTypes);

                subTypes.RemoveWhere(x => x == subType || x == typeof(char));
                if (subType == typeof(System.Threading.Tasks.Task))
                {
                    subTypes.RemoveWhere(x => x == typeof(System.Threading.Tasks.Task <>));
                }

                Filter(subType, subTypes, true);

                if (subTypes.Contains(type) && !IsEnumeratorOf(subType, type))
                {
                    types.RemoveWhere(x => x == subType);
                }
            }

            if (type == typeof(System.Runtime.InteropServices.UCOMIMoniker))
            {
                types.RemoveWhere(x => x == typeof(System.Runtime.InteropServices.UCOMIStream) || x == typeof(System.Runtime.InteropServices.UCOMIBindCtx));
            }
            if (type == typeof(System.Runtime.InteropServices.ComTypes.IMoniker))
            {
                types.RemoveWhere(x => x == typeof(System.Runtime.InteropServices.ComTypes.IStream) || x == typeof(System.Runtime.InteropServices.ComTypes.IBindCtx));
            }
        }