private void ProcessBases(StructDefinition node) { // Process the bases. int numbases = 0; AstNode baseNode = node.GetBases(); Structure building = node.GetStructure(); for (; baseNode != null; baseNode = baseNode.GetNext()) { // Visit the base. baseNode.Accept(this); // Get the node type. IChelaType baseType = baseNode.GetNodeType(); baseType = ExtractActualType(node, baseType); // Check base security. if (baseType.IsUnsafe()) { UnsafeError(node, "safe class/struct/interface with unsafe base/interface."); } // Check the class/struct/iface matches. if (!baseType.IsInterface() && baseType.IsClass() != building.IsClass()) { Error(baseNode, "incompatible base type."); } // Check for interface inheritance. if (building.IsInterface() && !baseType.IsInterface()) { Error(baseNode, "interfaces only can have interfaces as bases."); } // Only single inheritance, multiple interfaces. if (numbases >= 1 && !baseType.IsInterface()) { Error(baseNode, "only single inheritance and multiples interfaces is supported."); } // Set the base building. if (baseType.IsInterface()) { building.AddInterface((Structure)baseType); } else { Structure oldBase = building.GetBase(); Structure baseBuilding = (Structure)baseType; if (oldBase != null && oldBase != baseBuilding) { Error(node, "incompatible partial class bases."); } building.SetBase(baseBuilding); numbases++; } } // Notify the building. building.CompletedBases(); }