Mono.CSharp.MetadataImporter.ImportTypes C# (CSharp) Method

ImportTypes() protected method

protected ImportTypes ( Type types, Namespace targetNamespace, bool hasExtensionTypes ) : void
types IKVM.Reflection.Type
targetNamespace Namespace
hasExtensionTypes bool
return void
        protected void ImportTypes(MetaType[] types, Namespace targetNamespace, bool hasExtensionTypes)
        {
            Namespace ns = targetNamespace;
            string prev_namespace = null;
            foreach (var t in types) {
                if (t == null)
                    continue;

                // Be careful not to trigger full parent type loading
                if (t.MemberType == MemberTypes.NestedType)
                    continue;

                if (t.Name[0] == '<')
                    continue;

                var it = CreateType (t, null, new DynamicTypeReader (t), true);
                if (it == null)
                    continue;

                if (prev_namespace != t.Namespace) {
                    ns = t.Namespace == null ? targetNamespace : targetNamespace.GetNamespace (t.Namespace, true);
                    prev_namespace = t.Namespace;
                }

                ns.AddType (it);

                if (it.IsStatic && hasExtensionTypes &&
                    HasAttribute (CustomAttributeData.GetCustomAttributes (t), "ExtensionAttribute", CompilerServicesNamespace)) {
                    it.SetExtensionMethodContainer ();
                }
            }
        }