Ejemplo n.º 1
0
            internal IType ObtainTypeReference(ICliMetadataTypeDefinitionTableRow typeIdentity)
            {
                if (CliCommon.IsSpecialModule(typeIdentity))
                {
                    return(null);
                }
                IType result;

                lock (this.metadataTypeCache)
                {
                    if (!metadataTypeCache.TryGetValue(typeIdentity, out result))
                    {
                        var refAssem = this.manager.GetRelativeAssembly(typeIdentity.MetadataRoot);
                        if (CliCommon.IsBaseObject(this.manager, typeIdentity))
                        {
                            result = new CliClassType(refAssem, typeIdentity);
                        }
                        else if ((typeIdentity.TypeAttributes & TypeAttributes.Interface) == TypeAttributes.Interface &&
                                 (typeIdentity.TypeAttributes & TypeAttributes.Sealed) != TypeAttributes.Sealed)
                        {
                            result = new CliInterfaceType(refAssem, typeIdentity);
                        }
                        else if (CliCommon.IsBaseObject(this.manager, typeIdentity.Extends))
                        {
                            result = new CliClassType(refAssem, typeIdentity);
                        }
                        else if (CliCommon.IsEnum(this.manager, typeIdentity))
                        {
                            //result = new CliEnumType();
                            result = new CliEnumType(refAssem, typeIdentity);
                        }
                        else if (CliCommon.IsValueType(this.manager, typeIdentity))
                        {
                            result = new CliStructType(refAssem, typeIdentity);
                        }
                        else if (CliCommon.IsDelegate(this.manager, typeIdentity) && !CliCommon.IsBaseDelegateType(this.manager, typeIdentity))
                        {
                            result = new CliDelegateType(refAssem, typeIdentity);
                        }
                        else
                        {
                            result = new CliClassType(refAssem, typeIdentity);
                        }
                        this.metadataTypeCache.Add(typeIdentity, result);
                    }
                }
                return(result);
            }
Ejemplo n.º 2
0
 internal FieldMember(CliEnumType parent, ICliMetadataFieldTableRow metadataEntry, IGeneralMemberUniqueIdentifier uniqueIdentifier)
     : base(parent, metadataEntry, uniqueIdentifier)
 {
 }