Base class for all IL types
Наследование: MetaDataElement
Пример #1
0
        /// <summary>
        /// Find the Method for this method on the given type.
        /// </summary>
        internal Method findMethod(string qname, string methodName, string[] paramTypes, string returnType)
        {
            string key = getMethodKey(qname, methodName, paramTypes);
              Method method = (Method)methods[key];

              if (method == null)
              {
            // this stuff should be the same for both cases
            PERWAPI.Type rtype = findType(returnType);
            PERWAPI.Type[] pars = new PERWAPI.Type[paramTypes.Length];
            for (int i=0; i<paramTypes.Length; i++)
              pars[i] = findType(paramTypes[i]);

            // check for stubs
            object obj = findType(qname);
            if (obj is ClassDef)
            {
              // class is an internal stub, so we need to stub this
              // method out too, which should get flushed out later
              ClassDef cdef = obj as ClassDef;

              // TODO - need to fix attrs
              Param[] mpars = new Param[pars.Length];
              for (int i=0; i<mpars.Length; i++)
            mpars[i] = new Param(ParamAttr.Default, "v"+i, pars[i]);

              // TODO - fix param names
              // Use Public here for stub - real MethAttr will be set
              // when method is flushed out
              method = cdef.AddMethod(MethAttr.Public, ImplAttr.IL, methodName, rtype, mpars);
            }
            else if (obj is ClassRef)
            {
              // class is external, just get or add ref
              ClassRef cref = obj as ClassRef;
              method = cref.GetMethod(methodName, pars, new PERWAPI.Type[0]);
              if (method == null) method = cref.AddMethod(methodName, rtype, pars);
            }
            else throw new System.Exception("Don't know how to handle: " + obj.GetType());

            // make sure we add method to hashtable
            methods[key] = method;
              }

              return method;
        }
Пример #2
0
 internal void ldtoken(Type aType) {
     buffer.TypeInst(TypeOp.ldtoken, aType);
 }