예제 #1
0
        internal MonoFunctionType(IMonoStructType klass, Cecil.MethodDefinition mdef)
            : base(klass.File.MonoLanguage)
        {
            this.klass       = klass;
            this.method_info = mdef;
            this.token       = MonoDebuggerSupport.GetMethodToken(mdef);
            this.name        = GetMethodName(mdef) + MonoSymbolFile.GetMethodSignature(mdef);

            Cecil.TypeReference rtype;
            if (mdef.IsConstructor)
            {
                rtype           = mdef.DeclaringType;
                has_return_type = true;
            }
            else
            {
                rtype           = mdef.ReturnType;
                has_return_type = rtype.FullName != "System.Void";
            }
            return_type = klass.File.MonoLanguage.LookupMonoType(rtype);

            parameter_types = new TargetType [mdef.Parameters.Count];
            for (int i = 0; i < mdef.Parameters.Count; i++)
            {
                parameter_types [i] = klass.File.MonoLanguage.LookupMonoType(
                    mdef.Parameters[i].ParameterType);
            }
        }
예제 #2
0
        public MonoFunctionType LookupFunction(Cecil.MethodDefinition mdef)
        {
            int token = MonoDebuggerSupport.GetMethodToken(mdef);

            if (function_hash == null)
            {
                function_hash = new Dictionary <int, MonoFunctionType> ();
            }
            if (!function_hash.ContainsKey(token))
            {
                MonoFunctionType function = new MonoFunctionType(this, mdef);
                function_hash.Add(token, function);
                return(function);
            }

            return(function_hash [token]);
        }