+ public void BeginEventDef (EventDef event_def)
+ {
+ if (current_event != null)
+ Report.Error ("An event definition was not closed.");
+
+ current_event = event_def;
+ }
+
+ public void EndEventDef ()
+ {
+ if (event_list == null)
+ event_list = new ArrayList ();
+
+ event_list.Add (current_event);
+ current_event = null;
+ }
+
+ public void BeginPropertyDef (PropertyDef property_def)
+ {
+ if (current_property != null)
+ Report.Error ("A property definition was not closed.");
+
+ current_property = property_def;
+ }
+
+ public void EndPropertyDef ()
+ {
+ if (property_list == null)
+ property_list = new ArrayList ();
+
+ property_list.Add (current_property);
+ current_property = null;
+ }
+
+ public void AddCustomAttribute (CustomAttr customattr)
+ {
+ if (customattr_list == null)
+ customattr_list = new ArrayList ();
+
+ customattr_list.Add (customattr);
+ }
+
+ public GenericParameter GetGenericParam (string id)
+ {
+ if (gen_params == null)
+ return null;
+
+ return gen_params.GetGenericParam (id);
+ }
+
+ public GenericParameter GetGenericParam (int index)
+ {
+ if (gen_params == null || index < 0 || index >= gen_params.Count)
+ return null;
+
+ return gen_params [index];
+ }
+
+ public int GetGenericParamNum (string id)
+ {
+ if (gen_params == null)
+ return -1;
+
+ return gen_params.GetGenericParamNum (id);
+ }
+
+ /* Resolve any GenParams in constraints, parent & impl_list */
+ private void ResolveGenParams ()
+ {
+ if (gen_params == null)
+ return;
+
+ gen_params.ResolveConstraints (gen_params, null);
+
+ BaseGenericTypeRef gtr = parent as BaseGenericTypeRef;
+ if (gtr != null)
+ gtr.Resolve (gen_params, null);
+
+ if (impl_list == null)
+ return;
+
+ foreach (BaseClassRef impl in impl_list) {
+ gtr = impl as BaseGenericTypeRef;
+ if (gtr != null)
+ gtr.Resolve (gen_params, null);
+ }
+ }
+
+ private bool IsValueType (string ns, string name)
+ {
+ return (ns == "System" && name == "ValueType");
+ }
+
+ private bool IsEnumType (string ns, string name)
+ {
+ return (ns == "System" && name == "Enum");
+ }
+