- /// <summary>
- /// This function computes the Base class and also the
- /// list of interfaces that the class or struct @c implements.
- ///
- /// The return value is an array (might be null) of
- /// interfaces implemented (as Types).
- ///
- /// The @base_class argument is set to the base object or null
- /// if this is `System.Object'.
- /// </summary>
- public virtual TypeExpr [] GetClassBases (out TypeExpr base_class)
- {
- TypeExpr[] ifaces = GetNormalBases (out base_class);
-
- if (ifaces == null)
- return null;
-
- int count = ifaces.Length;
-
- for (int i = 0; i < count; i++) {
- TypeExpr iface = (TypeExpr) ifaces [i];
-
- if (!iface.IsInterface) {
- if (Kind != Kind.Class) {
- // TODO: location of symbol related ....
- Error_TypeInListIsNotInterface (Location, iface.GetSignatureForError ());
- }
- else if (base_class != null)
- Report.Error (1721, Location, "`{0}': Classes cannot have multiple base classes (`{1}' and `{2}')",
- GetSignatureForError (), base_class.GetSignatureForError (), iface.GetSignatureForError ());
- else {
- Report.Error (1722, Location, "`{0}': Base class `{1}' must be specified as first",
- GetSignatureForError (), iface.GetSignatureForError ());
- }
- return null;
- }
-
- for (int x = 0; x < i; x++) {
- if (iface.Equals (ifaces [x])) {
- Report.Error (528, Location,
- "`{0}' is already listed in " +
- "interface list", iface.GetSignatureForError ());
- return null;
- }
- }
-
- if ((Kind == Kind.Interface) &&
- !iface.AsAccessible (this)) {
- Report.Error (61, Location,
- "Inconsistent accessibility: base " +
- "interface `{0}' is less accessible " +
- "than interface `{1}'", iface.GetSignatureForError (),
- Name);
- return null;
- }
- }
- return ifaces;
- }
-