private Structure GetFirstType(Scope scope, string name) { // Get the member. ScopeMember member = scope.FindMember(name); // Use the default type of the group. if(member.IsTypeGroup()) { TypeGroup group = (TypeGroup)member; foreach(TypeGroupName gname in @group.GetBuildings()) { Structure building = gname.GetBuilding(); if(building != null) return building; } throw new ModuleException("failed to get first type in group."); } else if(!member.IsClass() && !member.IsStructure() && !member.IsInterface()) throw new ModuleException("expected class/structure/interface."); // Cast the member. return (Structure) member; }
private Structure GetDefaultType(Scope scope, string name) { // Get the member. ScopeMember member = scope.FindMember(name); // Use the default type of the group. if(member.IsTypeGroup()) { TypeGroup group = (TypeGroup)member; return group.GetDefaultType(); } else if(!member.IsClass() && !member.IsStructure() && !member.IsInterface()) throw new ModuleException("expected class/structure/interface."); // Cast the member. return (Structure) member; }