示例#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);
            }
示例#2
0
 internal ParameterDictionary(CliDelegateType parent)
     : base(parent.IdentityManager, parent.InvokeMethodIndex, parent.MetadataEntry.MetadataRoot, parent)
 {
     this.parent = parent;
 }