• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# TypeSystem.Instantiation类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Internal.TypeSystem.Instantiation的典型用法代码示例。如果您正苦于以下问题:C# Instantiation类的具体用法?C# Instantiation怎么用?C# Instantiation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Instantiation类属于Internal.TypeSystem命名空间,在下文中一共展示了Instantiation类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: InstantiatedMethodIL

        public InstantiatedMethodIL(MethodIL methodIL, Instantiation typeInstantiation, Instantiation methodInstantiation)
        {
            _methodIL = methodIL;

            _typeInstantiation = typeInstantiation;
            _methodInstantiation = methodInstantiation;
        }
开发者ID:niemyjski,项目名称:corert,代码行数:7,代码来源:InstantiatedMethodIL.cs


示例2: ConvertInstantiationToCanonForm

        /// <summary>
        /// Returns a new instantiation that canonicalizes all types in <paramref name="instantiation"/>
        /// if possible under the policy of '<paramref name="kind"/>'
        /// </summary>
        /// <param name="changed">True if the returned instantiation is different from '<paramref name="instantiation"/>'.</param>
        public static Instantiation ConvertInstantiationToCanonForm(Instantiation instantiation, CanonicalFormKind kind, out bool changed)
        {
            TypeDesc[] newInstantiation = null;

            for (int i = 0; i < instantiation.Length; i++)
            {
                TypeDesc typeToConvert = instantiation[i];
                TypeDesc convertedType = ConvertToCanon(typeToConvert, kind);

                if (typeToConvert != convertedType || newInstantiation != null)
                {
                    if (newInstantiation == null)
                    {
                        newInstantiation = new TypeDesc[instantiation.Length];
                        for (int j = 0; j < i; j++)
                            newInstantiation[j] = instantiation[j];
                    }

                    newInstantiation[i] = convertedType;
                }
            }

            changed = newInstantiation != null;
            if (changed)
            {
                return new Instantiation(newInstantiation);
            }

            return instantiation;
        }
开发者ID:tijoytom,项目名称:corert,代码行数:35,代码来源:StandardCanonicalizationAlgorithm.cs


示例3: ConvertInstantiationToCanonForm

 protected override Instantiation ConvertInstantiationToCanonForm(Instantiation instantiation, CanonicalFormKind kind, out bool changed)
 {
     if (CanonMode == CanonicalizationMode.Standard)
         return StandardCanonicalizationAlgorithm.ConvertInstantiationToCanonForm(instantiation, kind, out changed);
     else
         return RuntimeDeterminedCanonicalizationAlgorithm.ConvertInstantiationToCanonForm(instantiation, kind, out changed);
 }
开发者ID:krytarowski,项目名称:corert,代码行数:7,代码来源:TestTypeSystemContext.cs


示例4: InstantiateDependencies

        public IEnumerable<DependencyListEntry> InstantiateDependencies(NodeFactory factory, Instantiation typeInstantiation, Instantiation methodInstantiation)
        {
            switch (_id)
            {
                case ReadyToRunHelperId.GetGCStaticBase:
                case ReadyToRunHelperId.GetThreadStaticBase:
                    {
                        // If the type has a lazy static constructor, we also need the non-GC static base
                        // because that's where the class constructor context is.
                        TypeDesc type = (TypeDesc)_target;

                        if (factory.TypeSystemContext.HasLazyStaticConstructor(type))
                        {
                            return new[] {
                                new DependencyListEntry(
                                    factory.GenericLookup.TypeNonGCStaticBase(type).GetTarget(factory, typeInstantiation, methodInstantiation),
                                    "Dictionary dependency"),
                                new DependencyListEntry(
                                    _lookupSignature.GetTarget(factory, typeInstantiation, methodInstantiation),
                                    "Dictionary dependency") };
                        }
                    }
                    break;
            }

            // All other generic lookups just depend on the thing they point to
            return new[] { new DependencyListEntry(
                        _lookupSignature.GetTarget(factory, typeInstantiation, methodInstantiation),
                        "Dictionary dependency") };
        }
开发者ID:stephentoub,项目名称:corert,代码行数:30,代码来源:ReadyToRunGenericHelperNode.cs


示例5: ConvertInstantiationToSharedRuntimeForm

        public static Instantiation ConvertInstantiationToSharedRuntimeForm(Instantiation instantiation, Instantiation openInstantiation, out bool changed)
        {
            Debug.Assert(instantiation.Length == openInstantiation.Length);

            TypeDesc[] sharedInstantiation = null;

            CanonicalFormKind currentPolicy = CanonicalFormKind.Specific;
            CanonicalFormKind startLoopPolicy;

            do
            {
                startLoopPolicy = currentPolicy;

                for (int instantiationIndex = 0; instantiationIndex < instantiation.Length; instantiationIndex++)
                {
                    TypeDesc typeToConvert = instantiation[instantiationIndex];
                    TypeSystemContext context = typeToConvert.Context;
                    TypeDesc canonForm = context.ConvertToCanon(typeToConvert, ref currentPolicy);
                    TypeDesc runtimeDeterminedForm = typeToConvert;

                    Debug.Assert(openInstantiation[instantiationIndex] is GenericParameterDesc);

                    if ((typeToConvert != canonForm) || typeToConvert.IsCanonicalType)
                    {
                        Debug.Assert(canonForm is DefType);
                        if (sharedInstantiation == null)
                        {
                            sharedInstantiation = new TypeDesc[instantiation.Length];
                            for (int i = 0; i < instantiationIndex; i++)
                                sharedInstantiation[i] = instantiation[i];
                        }

                        runtimeDeterminedForm = context.GetRuntimeDeterminedType(
                            (DefType)canonForm, (GenericParameterDesc)openInstantiation[instantiationIndex]);
                    }

                    if (sharedInstantiation != null)
                    {
                        sharedInstantiation[instantiationIndex] = runtimeDeterminedForm;
                    }
                }

                // Optimization: even if canonical policy changed, we don't actually need to re-run the loop
                // for instantiations that only have a single element.
                if (instantiation.Length == 1)
                {
                    break;
                }

            } while (currentPolicy != startLoopPolicy);

            changed = sharedInstantiation != null;
            if (changed)
            {
                return new Instantiation(sharedInstantiation);
            }

            return instantiation;
        }
开发者ID:tijoytom,项目名称:corert,代码行数:59,代码来源:RuntimeDeterminedTypeUtilities.cs


示例6: InstantiatedMethod

        internal InstantiatedMethod(MethodDesc methodDef, Instantiation instantiation)
        {
            Debug.Assert(!(methodDef is InstantiatedMethod));
            _methodDef = methodDef;

            Debug.Assert(instantiation.Length > 0);
            _instantiation = instantiation;
        }
开发者ID:krytarowski,项目名称:corert,代码行数:8,代码来源:InstantiatedMethod.cs


示例7: ComputeRuntimeInterfaces

        public override DefType[] ComputeRuntimeInterfaces(TypeDesc _type)
        {
            ArrayType arrayType = (ArrayType)_type;
            Debug.Assert(arrayType.IsSzArray);
            Instantiation arrayInstantiation = new Instantiation(new TypeDesc[] { arrayType.ElementType });
            TypeDesc arrayOfTInstantiation = _arrayOfTType.Context.GetInstantiatedType(_arrayOfTType, arrayInstantiation);

            return arrayOfTInstantiation.RuntimeInterfaces;
        }
开发者ID:noahfalk,项目名称:corert,代码行数:9,代码来源:ArrayOfTRuntimeInterfacesAlgorithm.cs


示例8: InstantiateSignature

        public virtual FieldDesc InstantiateSignature(Instantiation typeInstantiation, Instantiation methodInstantiation)
        {
            FieldDesc field = this;

            TypeDesc owningType = field.OwningType;
            TypeDesc instantiatedOwningType = owningType.InstantiateSignature(typeInstantiation, methodInstantiation);
            if (owningType != instantiatedOwningType)
                field = instantiatedOwningType.Context.GetFieldForInstantiatedType(field.GetTypicalFieldDefinition(), (InstantiatedType)instantiatedOwningType);

            return field;
        }
开发者ID:niemyjski,项目名称:corert,代码行数:11,代码来源:FieldDesc.cs


示例9: InstantiatedMethodIL

        public InstantiatedMethodIL(MethodDesc owningMethod, MethodIL methodIL)
        {
            Debug.Assert(methodIL.GetMethodILDefinition() == methodIL);
            Debug.Assert(owningMethod.HasInstantiation || owningMethod.OwningType.HasInstantiation);
            Debug.Assert(owningMethod.GetTypicalMethodDefinition() == methodIL.OwningMethod);
            
            _methodIL = methodIL;
            _method = owningMethod;

            _typeInstantiation = owningMethod.OwningType.Instantiation;
            _methodInstantiation = owningMethod.Instantiation;
        }
开发者ID:tijoytom,项目名称:corert,代码行数:12,代码来源:InstantiatedMethodIL.cs


示例10: InstantiateSignature

        public override TypeDesc InstantiateSignature(Instantiation typeInstantiation, Instantiation methodInstantiation)
        {
            MethodSignatureBuilder sigBuilder = new MethodSignatureBuilder(_signature);
            sigBuilder.ReturnType = _signature.ReturnType.InstantiateSignature(typeInstantiation, methodInstantiation);
            for (int i = 0; i < _signature.Length; i++)
                sigBuilder[i] = _signature[i].InstantiateSignature(typeInstantiation, methodInstantiation);

            MethodSignature instantiatedSignature = sigBuilder.ToSignature();
            if (instantiatedSignature != _signature)
                return Context.GetFunctionPointerType(instantiatedSignature);

            return this;
        }
开发者ID:krytarowski,项目名称:corert,代码行数:13,代码来源:FunctionPointerType.cs


示例11: InstantiateSignature

 public override TypeDesc InstantiateSignature(Instantiation typeInstantiation, Instantiation methodInstantiation)
 {
     GenericParameter parameter = _module.MetadataReader.GetGenericParameter(_handle);
     if (parameter.Parent.Kind == HandleKind.MethodDefinition)
     {
         return methodInstantiation[parameter.Index];
     }
     else
     {
         Debug.Assert(parameter.Parent.Kind == HandleKind.TypeDefinition);
         return typeInstantiation[parameter.Index];
     }
 }
开发者ID:niemyjski,项目名称:corert,代码行数:13,代码来源:EcmaGenericParameter.cs


示例12: ConvertInstantiationToCanonForm

        public static Instantiation ConvertInstantiationToCanonForm(Instantiation instantiation, CanonicalFormKind kind, out bool changed)
        {
            TypeDesc[] canonInstantiation = null;

            CanonicalFormKind currentKind = kind;
            CanonicalFormKind startLoopKind;

            // This logic is wrapped in a loop because we might potentially need to restart canonicalization if the policy
            // changes due to one of the instantiation arguments already being universally canonical.
            do
            {
                startLoopKind = currentKind;

                for (int instantiationIndex = 0; instantiationIndex < instantiation.Length; instantiationIndex++)
                {
                    TypeDesc typeToConvert = instantiation[instantiationIndex];
                    TypeDesc canonForm = ConvertToCanon(typeToConvert, ref currentKind);
                    if (typeToConvert != canonForm || canonInstantiation != null)
                    {
                        if (canonInstantiation == null)
                        {
                            canonInstantiation = new TypeDesc[instantiation.Length];
                            for (int i = 0; i < instantiationIndex; i++)
                                canonInstantiation[i] = instantiation[i];
                        }

                        canonInstantiation[instantiationIndex] = canonForm;
                    }
                }

                // Optimization: even if canonical policy changed, we don't actually need to re-run the loop
                // for instantiations that only have a single element.
                if (instantiation.Length == 1)
                {
                    break;
                }

            } while (currentKind != startLoopKind);


            changed = canonInstantiation != null;
            if (changed)
            {
                return new Instantiation(canonInstantiation);
            }

            return instantiation;
        }
开发者ID:nattress,项目名称:corert,代码行数:48,代码来源:RuntimeDeterminedCanonicalizationAlgorithm.cs


示例13: NoMetadataType

        public NoMetadataType(TypeSystemContext context, RuntimeTypeHandle genericTypeDefinition, DefType genericTypeDefinitionAsDefType, Instantiation instantiation, int hashcode)
        {
            _hashcode = hashcode;
            _context = context;
            _genericTypeDefinition = genericTypeDefinition;
            _genericTypeDefinitionAsDefType = genericTypeDefinitionAsDefType;
            if (_genericTypeDefinitionAsDefType == null)
                _genericTypeDefinitionAsDefType = this;
            _instantiation = instantiation;

            // Instantiation must either be:
            // Something valid (if the type is generic, or a generic type definition)
            // or Empty (if the type isn't a generic of any form)
            unsafe
            {
                Debug.Assert(((_instantiation.Length > 0) && _genericTypeDefinition.ToEETypePtr()->IsGenericTypeDefinition) ||
                             ((_instantiation.Length == 0) && !_genericTypeDefinition.ToEETypePtr()->IsGenericTypeDefinition));
            }
        }
开发者ID:nattress,项目名称:corert,代码行数:19,代码来源:RuntimeNoMetadataType.cs


示例14: GetTarget

 public abstract ISymbolNode GetTarget(NodeFactory factory, Instantiation typeInstantiation, Instantiation methodInstantiation);
开发者ID:justinvp,项目名称:corert,代码行数:1,代码来源:GenericLookupResult.cs


示例15: InstantiateSignature

 public override TypeDesc InstantiateSignature(Instantiation typeInstantiation, Instantiation methodInstantiation)
 {
     TypeDesc instantiatedParameterType = this.ParameterType.InstantiateSignature(typeInstantiation, methodInstantiation);
     return instantiatedParameterType.MakeByRefType();
 }
开发者ID:huamichaelchen,项目名称:corert,代码行数:5,代码来源:ByRefType.cs


示例16: InstantiateSignature

 public virtual TypeDesc InstantiateSignature(Instantiation typeInstantiation, Instantiation methodInstantiation)
 {
     return this;
 }
开发者ID:mjp41,项目名称:corert,代码行数:4,代码来源:TypeDesc.cs


示例17: InstantiateSignature

        public virtual MethodDesc InstantiateSignature(Instantiation typeInstantiation, Instantiation methodInstantiation)
        {
            Instantiation instantiation = Instantiation;
            TypeDesc[] clone = null;

            for (int i = 0; i < instantiation.Length; i++)
            {
                TypeDesc uninst = instantiation[i];
                TypeDesc inst = uninst.InstantiateSignature(typeInstantiation, methodInstantiation);
                if (inst != uninst)
                {
                    if (clone == null)
                    {
                        clone = new TypeDesc[instantiation.Length];
                        for (int j = 0; j < clone.Length; j++)
                        {
                            clone[j] = instantiation[j];
                        }
                    }
                    clone[i] = inst;
                }
            }

            MethodDesc method = this;

            TypeDesc owningType = method.OwningType;
            TypeDesc instantiatedOwningType = owningType.InstantiateSignature(typeInstantiation, methodInstantiation);
            if (owningType != instantiatedOwningType)
            {
                method = Context.GetMethodForInstantiatedType(method.GetTypicalMethodDefinition(), (InstantiatedType)instantiatedOwningType);
                if (clone == null && instantiation.Length != 0)
                    return Context.GetInstantiatedMethod(method, instantiation);
            }

            return (clone == null) ? method : Context.GetInstantiatedMethod(method.GetMethodDefinition(), new Instantiation(clone));
        }
开发者ID:shahid-pk,项目名称:corert,代码行数:36,代码来源:MethodDesc.cs


示例18: InstantiateSignature

        public override MethodDesc InstantiateSignature(Instantiation typeInstantiation, Instantiation methodInstantiation)
        {
            TypeDesc owningType = this.OwningType;
            TypeDesc instantiatedOwningType = owningType.InstantiateSignature(typeInstantiation, methodInstantiation);

            if (owningType != instantiatedOwningType)
                return ((ArrayType)instantiatedOwningType).GetArrayMethod(_kind);
            else
                return this;
        }
开发者ID:morganbr,项目名称:corert,代码行数:10,代码来源:ArrayType.cs


示例19: InstantiateSignature

 public override TypeDesc InstantiateSignature(Instantiation typeInstantiation, Instantiation methodInstantiation)
 {
     return typeInstantiation.IsNull ? this : typeInstantiation[Index];
 }
开发者ID:hoyMS,项目名称:corert,代码行数:4,代码来源:SignatureVariable.cs


示例20: InstantiateSignature

 public override TypeDesc InstantiateSignature(Instantiation typeInstantiation, Instantiation methodInstantiation)
 {
     if (_runtimeDeterminedDetailsType.Kind == GenericParameterKind.Type)
     {
         return typeInstantiation[_runtimeDeterminedDetailsType.Index];
     }
     else
     {
         Debug.Assert(_runtimeDeterminedDetailsType.Kind == GenericParameterKind.Method);
         return methodInstantiation[_runtimeDeterminedDetailsType.Index];
     }
 }
开发者ID:tijoytom,项目名称:corert,代码行数:12,代码来源:RuntimeDeterminedType.cs



注:本文中的Internal.TypeSystem.Instantiation类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# TypeSystem.MetadataType类代码示例发布时间:2022-05-26
下一篇:
C# TypeSystem.FieldDesc类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap