コード例 #1
0
 public void Substitute(GenericParameterCollection methodParams)
 {
     if (ReturnType != null)
     {
         ReturnType.Resolve(ref ReturnType, ParentType.GenericParameters, methodParams);
     }
     Parameters.ForEach(p => p.Substitute());
     Locals.ForEach(l => l.Substitute());
     Instructions.ForEach(i => i.Substitute());
 }
コード例 #2
0
 public void Substitute(GenericParameterCollection typeParams, GenericParameterCollection methodParams)
 {
     for (int i = 0; i < mParams.Count; i++)
     {
         IRType t = mParams[i];
         t.Resolve(ref t, typeParams, methodParams);
         mParams[i] = t;
     }
     mHashCodeCache = null;
     mResolvedCache = null;
 }
コード例 #3
0
ファイル: IRType.cs プロジェクト: Astaelan/Fusion
        /// <summary>
        /// Resolve any generic types used in this type.
        /// </summary>
        /// <param name="selfReference"></param>
        /// <param name="typeParams"></param>
        /// <param name="methodParams"></param>
        public void Resolve(ref IRType selfReference, GenericParameterCollection typeParams, GenericParameterCollection methodParams)
        {
            if (!Resolved)
            {
                if (IsGeneric)
                {
                    if (IsTemporaryVar)
                    {
                        selfReference = typeParams[this.TemporaryVarOrMVarIndex];
                    }
                    else if (IsTemporaryMVar)
                    {
                        selfReference = methodParams[this.TemporaryVarOrMVarIndex];
                    }
                    else if (IsArrayType)
                    {
                        IRType elemType = ArrayType;
                        elemType.Resolve(ref elemType, typeParams, methodParams);
                        selfReference = Assembly.AppDomain.GetArrayType(elemType);
                    }
                    else if (this.GenericParameters.Resolved)
                    {
                        IRType tp = null;
                        if (!GenericTypes.TryGetValue(this, out tp))
                        {
                            tp = this.GenericType.Clone();
                            tp.GenericParameters.Substitute(typeParams, methodParams);
                            GenericTypes[tp] = tp;

                            for (int i = 0; i < tp.GenericParameters.Count; i++)
                            {
                                tp.GenericParameters[i] = this.GenericParameters[i];
                            }
                            for (int i = 0; i < tp.Methods.Count; i++)
                            {
                                tp.Methods[i] = tp.Methods[i].Resolved ? tp.Methods[i] : tp.Methods[i].Clone(tp);
                            }

                            tp.Substitute(typeParams, methodParams);
                        }
                        selfReference = tp;
                    }
                    else
                    {
#warning Need to do the rest of this resolution.
                    }
                }
                else
                {
                    Substitute(GenericParameterCollection.Empty, GenericParameterCollection.Empty);
                }
            }
        }
コード例 #4
0
ファイル: IRType.cs プロジェクト: Astaelan/Fusion
        /// <summary>
        /// Resolves generic parameters within this type.
        /// </summary>
        /// <param name="typeParams"></param>
        /// <param name="methodParams"></param>
        public void Substitute(GenericParameterCollection typeParams, GenericParameterCollection methodParams)
        {
            this.GenericParameters.Substitute(typeParams, methodParams);

            if (!GenericParameters.Resolved)
            {
                return;
            }

            if (this.BaseType != null)
            {
                this.BaseType.Resolve(ref this.BaseType, this.GenericParameters, GenericParameterCollection.Empty);
            }

            this.Fields.ForEach(f => f.Substitute());
            this.Methods.ForEach(m => m.Substitute(GenericParameterCollection.Empty));
        }
コード例 #5
0
 public void Resolve(GenericParameterCollection typeParams, GenericParameterCollection methodParams)
 {
 }