public string Compose() { if (isComposed || type == PACKAGE || type == MODULE) { isComposed = true; return(null); } if (isComposing) { return("Circularity detected while composing " + stable.name); } isComposing = true; string err; foreach (STable su in superclasses) { err = su.mo.Compose(); if (err != null) { return(err); } } isComposed = true; if (type == ROLE || type == PARAMETRIZED_ROLE || type == CURRIED_ROLE) { role_typecheck_list.Add(stable); SetMRO(Kernel.AnyMO.mo.mro); Revalidate(); stable.SetupVTables(); return(null); } if (local_roles.Count > 0) { Kernel.ApplyRoleToClass(stable, local_roles.ToArray()); } if (superclasses.Count == 0 && stable != Kernel.MuMO) { superclasses.Add(type == GRAMMAR ? Kernel.GrammarMO : Kernel.AnyMO); } STable[][] lists = new STable[superclasses.Count + 2][]; lists[0] = new STable[] { stable }; lists[superclasses.Count + 1] = superclasses.ToArray(); for (int i = 0; i < superclasses.Count; i++) { lists[i + 1] = superclasses[i].mo.mro; } List <STable> nmro = new List <STable>(); err = C3Merge(nmro, lists); if (err != null) { return("C3 MRO generation failed for " + stable.name + ": " + err); } SetMRO(nmro.ToArray()); List <string> all_slot_l = new List <string>(); foreach (STable m in mro) { foreach (AttrInfo ai in m.mo.local_attr) { all_slot_l.Add(ai.name); } } stable.all_slot = all_slot_l.ToArray(); stable.nslots = 0; foreach (string an in stable.all_slot) { stable.slotMap[an] = stable.nslots++; } Revalidate(); stable.SetupVTables(); return(null); }