* FieldTable.cs: Add method to check if all fields have been defined, set referenced fields properties when defining them
* ClassTable.cs: Make sure all methods and fields are defined.
svn path=/trunk/mcs/; revision=12648
+2003-03-17 Jackson Harper <jackson@latitudegeo.com>
+
+ * MethodTable.cs: Add method to Check if all methods have been defined, set referenced methods properties
+ when defining them
+ * FieldTable.cs: Add method to check if all fields have been defined, set referenced fields properties
+ when defining them
+ * ClassTable.cs: Make sure all methods and fields are defined.
+
2003-03-16 Jackson Harper <jackson@latitudegeo.com>
* MethodTable.cs: Fire events when methods are defined and referenced
}
}
+ public bool CheckDefined ()
+ {
+ if (!Defined)
+ return false;
+
+ if (!FieldTable.CheckDefined ())
+ return false;
+
+ if (!MethodTable.CheckDefined ())
+ return false;
+
+ return true;
+ }
+
public MethodTable MethodTable {
get { return method_table; }
}
{
foreach (DictionaryEntry dic_entry in table) {
ClassTableItem table_item = (ClassTableItem) dic_entry.Value;
- if (table_item.Defined)
+ if (table_item.CheckDefined ())
continue;
throw new Exception (String.Format ("Type: {0} is not defined.", dic_entry.Key));
}
private int flags;
public ArrayList LocationList;
- public Field Field;
+ public FieldDef Field;
- public FieldTableItem (Field field, Location location)
+ public FieldTableItem (FieldDef field, Location location)
{
flags = 0;
Field = field;
public FieldDef AddDefinition (FieldAttr field_attr, string name,
TypeRef type, Location location)
{
- CheckExists (name);
-
- FieldDef field = parent_class.AddField (field_attr, name, type.Type);
- AddDefined (name, field, location);
+ FieldTableItem item = (FieldTableItem) table[name];
- return field;
+ if (item == null) {
+ FieldDef field = parent_class.AddField (field_attr, name, type.Type);
+ AddDefined (name, field, location);
+ return field;
+ }
+
+ item.Field.AddFieldAttr (field_attr);
+ item.Defined = true;
+
+ return item.Field;
+ }
+
+ public bool CheckDefined ()
+ {
+ foreach (DictionaryEntry dic_entry in table) {
+ FieldTableItem table_item = (FieldTableItem) dic_entry.Value;
+ if (table_item.Defined)
+ continue;
+ throw new Exception (String.Format ("Field: {0} is not defined.", dic_entry.Key));
+ }
+ return true;
}
protected void AddDefined (string signature, FieldDef field, Location location)
table[signature] = item;
}
- protected void AddReferenced (string signature, Field field, Location location)
+ protected void AddReferenced (string signature, FieldDef field, Location location)
{
FieldTableItem item = new FieldTableItem (field, location);
private int flags;
public ArrayList LocationList;
- public Method Method;
+ public MethodDef Method;
- public MethodTableItem (Method method, Location location)
+ public MethodTableItem (MethodDef method, Location location)
{
flags = 0;
Method = method;
return_type, param_list, table.Contains (signature), method_attr,
impl_attr, call_conv));
- CheckExists (signature);
-
- MethodDef method = parent_class.AddMethod (method_attr, impl_attr, name,
- return_type.Type, param_list);
- method.AddCallConv (call_conv);
- AddDefined (signature, method, location);
+ MethodTableItem item = (MethodTableItem) table[signature];
- return method;
- }
+ 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;
+ }
+
+ public bool CheckDefined ()
+ {
+ foreach (DictionaryEntry dic_entry in table) {
+ MethodTableItem table_item = (MethodTableItem) dic_entry.Value;
+ if (table_item.Defined)
+ continue;
+ throw new Exception (String.Format ("Method: {0} is not defined.", dic_entry.Key));
+ }
+ return true;
+ }
+
protected string GetSignature (string name, TypeRef return_type,
TypeRef[] param_list)
{
table[signature] = item;
}
- protected void AddReferenced (string signature, Method method, Location location)
+ protected void AddReferenced (string signature, MethodDef method, Location location)
{
MethodTableItem item = new MethodTableItem (method, location);