コード例 #1
0
        /// <summary>
        /// Get a CorType that function for this frame is declared in.
        /// </summary>
        /// <returns>The cortype of the function</returns>
        private CorType GetClassType()
        {
            CorClass c = thisFrame.Function.Class;

            if (TokenUtils.RidFromToken(c.Token) != 1 && TokenUtils.RidFromToken(c.Token) != 0)
            {
                // ICorDebug API lets us always pass ET_Class
                CorElementType et = CorElementType.ELEMENT_TYPE_CLASS;
                // Get type parameters.
                IEnumerable typars = thisFrame.TypeParameters;
                //IEnumerator tyenum = typars.GetEnumerator();
                int       cNumTyParamsOnClass = metaImporter.CountGenericParams(c.Token);
                CorType[] types = new CorType[cNumTyParamsOnClass];
                int       it    = 0;
                foreach (CorType arg in typars)
                {
                    if (it == cNumTyParamsOnClass)
                    {
                        break;
                    }
                    types[it] = arg;
                    it++;
                }
                return(c.GetParameterizedType(et, types));
            }
            else
            {
                return(null);
            }
        }
コード例 #2
0
 public IDebuggerType ToType(IDebuggerType[] typeArgs)
 {
     return(debugger.Dispatcher.UI(() => {
         // We can use Class all the time, even for value types
         var type = cls.GetParameterizedType(dndbg.COM.CorDebug.CorElementType.Class, typeArgs.ToCorTypes());
         return type == null ? null : new DebuggerType(debugger, type, token);
     }));
 }
コード例 #3
0
        public override object GetEnclosingType(EvaluationContext gctx)
        {
            CorEvaluationContext ctx = (CorEvaluationContext)gctx;

            if (ctx.Frame.FrameType != CorFrameType.ILFrame || ctx.Frame.Function == null)
            {
                return(null);
            }

            CorClass       cls   = ctx.Frame.Function.Class;
            List <CorType> tpars = new List <CorType> ();

            foreach (CorType t in ctx.Frame.TypeParameters)
            {
                tpars.Add(t);
            }
            return(cls.GetParameterizedType(CorElementType.ELEMENT_TYPE_CLASS, tpars.ToArray()));
        }
コード例 #4
0
        public override object GetType(EvaluationContext gctx, string name, object[] gtypeArgs)
        {
            CorType[] typeArgs = CastArray <CorType> (gtypeArgs);

            CorEvaluationContext ctx = (CorEvaluationContext)gctx;

            foreach (CorModule mod in ctx.Session.GetModules())
            {
                CorMetadataImport mi = ctx.Session.GetMetadataForModule(mod.Name);
                if (mi != null)
                {
                    foreach (Type t in mi.DefinedTypes)
                    {
                        if (t.FullName == name)
                        {
                            CorClass cls = mod.GetClassFromToken(t.MetadataToken);
                            return(cls.GetParameterizedType(CorElementType.ELEMENT_TYPE_CLASS, typeArgs));
                        }
                    }
                }
            }
            return(null);
        }