Esempio 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);
        }
Esempio n. 2
0
        public Method GetReference(string name, TypeRef return_type,
                                   Param[] param_list, TypeRef[] param_type_list, Location location)
        {
            string signature = GetSignature(name, return_type, param_type_list);

            if (MethodReferencedEvent != null)
            {
                MethodReferencedEvent(this, new MethodReferencedEventArgs(signature, name,
                                                                          return_type, param_list, table.Contains(signature)));
            }

            MethodTableItem item = table[signature] as MethodTableItem;

            if (item != null)
            {
                item.LocationList.Add(location);
                return(item.Method);
            }

            MethodDef method = parent_class.AddMethod(name, return_type.Type,
                                                      param_list);

            AddReferenced(signature, method, location);

            return(method);
        }
Esempio n. 3
0
        /// <summary>
        ///  If a method is allready defined throw an Error
        /// </summary>
        protected void CheckExists(string signature)
        {
            MethodTableItem item = table[signature] as MethodTableItem;

            if ((item != null) && (item.Defined))
            {
                Report.Error(String.Format("Method: {0} defined in multiple locations.",
                                           signature));
            }
        }
Esempio n. 4
0
        protected void AddDefined(string signature, MethodDef method, Location location)
        {
            if (table.Contains(signature))
            {
                return;
            }

            MethodTableItem item = new MethodTableItem(method, location);

            item.Defined = true;

            table[signature] = item;
        }
Esempio n. 5
0
 public bool CheckDefined()
 {
     foreach (DictionaryEntry dic_entry in table)
     {
         MethodTableItem table_item = (MethodTableItem)dic_entry.Value;
         if (table_item.Defined)
         {
             continue;
         }
         Report.Error(String.Format("Method: {0} is not defined.", dic_entry.Key));
     }
     return(true);
 }
Esempio n. 6
0
        protected void AddReferenced(string signature, MethodDef method, Location location)
        {
            MethodTableItem item = new MethodTableItem(method, location);

            table[signature] = item;
        }
Esempio n. 7
0
		protected void AddReferenced (string signature, MethodDef method, Location location)
		{
			MethodTableItem item = new MethodTableItem (method, location);
			
			table[signature] = item;
		}
Esempio n. 8
0
		protected void AddDefined (string signature, MethodDef method, Location location)
		{
			if (table.Contains (signature))
				return; 

			MethodTableItem item = new MethodTableItem (method, location);
			item.Defined = true;

			table[signature] = item;
		}