Ejemplo n.º 1
0
        public MethodDef AddDefinition(MethAttr method_attr, ImplAttr impl_attr, CallConv call_conv,
                                       string name, TypeRef return_type, Param[] param_list,
                                       TypeRef[] param_type_list, Location location)
        {
            string signature = GetSignature(name, return_type, param_type_list);

            if (MethodDefinedEvent != null)
            {
                MethodDefinedEvent(this, new MethodDefinedEventArgs(signature, name,
                                                                    return_type, param_list, table.Contains(signature), method_attr,
                                                                    impl_attr, call_conv));
            }

            MethodTableItem item = (MethodTableItem)table[signature];

            if (item == null)
            {
                MethodDef method = parent_class.AddMethod(method_attr, impl_attr, name,
                                                          return_type.Type, param_list);
                method.AddCallConv(call_conv);
                AddDefined(signature, method, location);
                return(method);
            }

            item.Method.AddMethAttribute(method_attr);
            item.Method.AddImplAttribute(impl_attr);
            item.Method.AddCallConv(call_conv);
            item.Defined = true;

            return(item.Method);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Add a "global" method to this module
        /// </summary>
        /// <param name="mAtts">method attributes</param>
        /// <param name="iAtts">method implementation attributes</param>
        /// <param name="name">method name</param>
        /// <param name="genPars">generic parameters</param>
        /// <param name="retType">return type</param>
        /// <param name="pars">method parameters</param>
        /// <returns>a descriptor for this new "global" method</returns>
        public MethodDef AddMethod(MethAttr mAtts, ImplAttr iAtts, string name, GenericParam[] genPars, Type retType, Param[] pars)
        {
            //FIXME Contract.Requires(defaultClass != null);
            MethodDef newMeth = defaultClass.AddMethod(mAtts, iAtts, name, genPars, retType, pars);

            return(newMeth);
        }
Ejemplo n.º 3
0
 public MethodDefinedEventArgs(string signature, string name,
                               TypeRef return_type, Param[] param_list, bool is_in_table, MethAttr method_attr,
                               ImplAttr impl_attr, CallConv call_conv) : base(signature, name,
                                                                              return_type, param_list, is_in_table)
 {
     MethodAttributes = method_attr;
     ImplAttributes   = impl_attr;
     CallConv         = call_conv;
 }
Ejemplo n.º 4
0
		public MethodDefinedEventArgs (string signature, string name, 
			TypeRef return_type, Param[] param_list, bool is_in_table, MethAttr method_attr, 
			ImplAttr impl_attr, CallConv call_conv) : base (signature, name, 
			return_type, param_list, is_in_table)
		{
			MethodAttributes = method_attr;
			ImplAttributes = impl_attr;
			CallConv = call_conv;
		}
Ejemplo n.º 5
0
		/// <summary>
		/// Add a method to this class
		/// </summary>
		/// <param name="mAtts">attributes for this method</param>
		/// <param name="iAtts">implementation attributes for this method</param>
		/// <param name="name">method name</param>
		/// <param name="retType">return type</param>
		/// <param name="pars">parameters</param>
		/// <returns>a descriptor for this new method</returns>
		public MethodDef AddMethod(MethAttr mAtts, ImplAttr iAtts, string name, 
				Param ret_param, Param [] pars) {
			// Console.WriteLine("Adding method " + name + " to class " + this.name);
			MethodDef meth = new MethodDef (metaData, mAtts, iAtts, name, ret_param, pars);
			methods.Add(meth);
			return meth;
		}
Ejemplo n.º 6
0
 /// <summary>
 /// Add a "global" method to this module
 /// </summary>
 /// <param name="mAtts">method attributes</param>
 /// <param name="iAtts">method implementation attributes</param>
 /// <param name="name">method name</param>
 /// <param name="retType">return type</param>
 /// <param name="pars">method parameters</param>
 /// <returns>a descriptor for this new "global" method</returns>
 public MethodDef AddMethod(MethAttr mAtts, ImplAttr iAtts, string name, Type retType, Param[] pars) {
   return moduleClass.AddMethod(mAtts,iAtts,name,retType,pars);
 }
Ejemplo n.º 7
0
 internal MethodDef(MetaData md, MethAttr mAttrSet, ImplAttr iAttrSet, string name, Type retType, Param[] pars) : base(name,retType) {
   metaData = md;
                     parList = pars;
                     if (parList != null) numPars = parList.Length;
   // Console.WriteLine("Creating method " + name + " with " + numPars + " parameters");
                     methFlags = (ushort)mAttrSet;
   implFlags = (ushort)iAttrSet;
   tabIx = MDTable.Method;
 }
Ejemplo n.º 8
0
		public MethodDef AddMethod(MethAttr mAtts, ImplAttr iAtts, string name, Type retType, Param[] pars) 
		{
			return AddMethod (mAtts, iAtts, name, new Param (ParamAttr.Default, "", retType), pars);
		}
Ejemplo n.º 9
0
 /// <summary>
 /// Add a method to this class
 /// </summary>
 /// <param name="mAtts">attributes for this method</param>
 /// <param name="iAtts">implementation attributes for this method</param>
 /// <param name="name">method name</param>
 /// <param name="genPars">generic parameters</param>
 /// <param name="retType">return type</param>
 /// <param name="pars">parameters</param>
 /// <returns>a descriptor for this new method</returns>
 public MethodDef AddMethod(MethAttr mAtts, ImplAttr iAtts, string name,
     GenericParam[] genPars, Type retType, Param[] pars)
 {
     Contract.Requires(name != null);
     Contract.Requires(genPars != null);
     Contract.Requires(retType != null);
     Contract.Requires(pars != null);
     MethodDef meth = AddMethod(name, genPars, retType, pars);
     meth.AddMethAttribute(mAtts);
     meth.AddImplAttribute(iAtts);
     return meth;
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Add a "global" method to this module
 /// </summary>
 /// <param name="mAtts">method attributes</param>
 /// <param name="iAtts">method implementation attributes</param>
 /// <param name="name">method name</param>
 /// <param name="genPars">generic parameters</param>
 /// <param name="retType">return type</param>
 /// <param name="pars">method parameters</param>
 /// <returns>a descriptor for this new "global" method</returns>
 public MethodDef AddMethod(MethAttr mAtts, ImplAttr iAtts, string name, GenericParam[] genPars, Type retType, Param[] pars)
 {
     //FIXME Contract.Requires(defaultClass != null);
     MethodDef newMeth = defaultClass.AddMethod(mAtts, iAtts, name, genPars, retType, pars);
     return newMeth;
 }
Ejemplo n.º 11
0
 public void SetImplAttributes(ImplAttr ia)
 {
     implFlags = (ushort)ia;
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Add a method to this class
 /// </summary>
 /// <param name="mAtts">attributes for this method</param>
 /// <param name="iAtts">implementation attributes for this method</param>
 /// <param name="name">method name</param>
 /// <param name="genPars">generic parameters</param>
 /// <param name="retType">return type</param>
 /// <param name="pars">parameters</param>
 /// <returns>a descriptor for this new method</returns>
 public MethodDef AddMethod(MethAttr mAtts, ImplAttr iAtts, string name,
     GenericParam[] genPars, Type retType, Param[] pars)
 {
     MethodDef meth = AddMethod(name,genPars,retType,pars);
     meth.AddMethAttribute(mAtts);
     meth.AddImplAttribute(iAtts);
     return meth;
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Add a "global" method to this module
 /// </summary>
 /// <param name="mAtts">method attributes</param>
 /// <param name="iAtts">method implementation attributes</param>
 /// <param name="name">method name</param>
 /// <param name="genPars">generic parameters</param>
 /// <param name="retType">return type</param>
 /// <param name="pars">method parameters</param>
 /// <returns>a descriptor for this new "global" method</returns>
 public MethodDef AddMethod(MethAttr mAtts, ImplAttr iAtts, string name, GenericParam[] genPars, Type retType, Param[] pars)
 {
     MethodDef newMeth = defaultClass.AddMethod(mAtts,iAtts,name,genPars,retType,pars);
     return newMeth;
 }
Ejemplo n.º 14
0
		public MethodDef AddDefinition (MethAttr method_attr, ImplAttr impl_attr, CallConv call_conv, 
			string name, TypeRef return_type, Param[] param_list, 
			TypeRef[] param_type_list, Location location) 
		{
			string signature = GetSignature (name, return_type, param_type_list);

			if (MethodDefinedEvent != null)
				MethodDefinedEvent (this, new MethodDefinedEventArgs (signature, name,
					return_type, param_list, table.Contains (signature), method_attr, 
					impl_attr, call_conv));

			MethodTableItem item = (MethodTableItem) table[signature];
			
			if (item == null) {
				MethodDef method = parent_class.AddMethod (method_attr, impl_attr, name, 
					return_type.Type, param_list);
				method.AddCallConv (call_conv);
				AddDefined (signature, method, location);
				return method;
			}
			
			item.Method.AddMethAttribute (method_attr);
			item.Method.AddImplAttribute (impl_attr);
			item.Method.AddCallConv (call_conv);
			item.Defined = true;
		
			return item.Method;
		}
Ejemplo n.º 15
0
		internal MethodDef (MetaData md, MethAttr mAttrSet, ImplAttr iAttrSet, string name, 
				Param ret_param, Param [] pars) 
			: base (name)
		{
			methFlags = (ushort)mAttrSet;
			implFlags = (ushort)iAttrSet;
			this.ret_param = ret_param;
			metaData = md;
			parList = pars;
			if (parList != null) 
				numPars = parList.Length;
			tabIx = MDTable.Method;
		}
Ejemplo n.º 16
0
 public void SetImplAttributes(ImplAttr ia)
 {
     implFlags = (ushort)ia;
 }
Ejemplo n.º 17
0
		/// <summary>
		/// Add some implementation attributes to this method descriptor
		/// </summary>
		/// <param name="ia">the attributes to be added</param>
		public void AddImplAttribute(ImplAttr ia) 
		{
			implFlags |= (ushort)ia;
		}
Ejemplo n.º 18
0
 /// <summary>
 /// Add some implementation attributes to this method descriptor
 /// </summary>
 /// <param name="ia">the attributes to be added</param>
 public void AddImplAttribute(ImplAttr ia)
 {
     implFlags |= (ushort)ia;
 }