118 : component.getBaseComponents()) {
120 report, enclosingComponent, componentLookup, *cur, component.getSrcLoc(), activeBinding);
133 std::set<const Component*> parents;
134 std::function<void(
const Component&)> collectParents = [&](
const Component& cur) {
135 for (
const auto&
base : cur.getBaseComponents()) {
136 auto c = componentLookup.getComponent(enclosingComponent,
base->getName(), binding);
140 if (parents.insert(c).second) {
145 collectParents(component);
148 for (
const Relation*
relation : component.getRelations()) {
149 if (component.getOverridden().count(
relation->getQualifiedName().getQualifiers()[0]) != 0u) {
150 report.addError(
"Override of non-inherited relation " +
151 relation->getQualifiedName().getQualifiers()[0] +
" in component " +
152 component.getComponentType()->getName(),
153 component.getSrcLoc());
156 for (
const Component* parent : parents) {
157 for (
const Relation*
relation : parent->getRelations()) {
158 if ((component.getOverridden().count(
relation->getQualifiedName().getQualifiers()[0]) != 0u) &&
160 report.addError(
"Override of non-overridable relation " +
161 relation->getQualifiedName().getQualifiers()[0] +
" in component " +
162 component.getComponentType()->getName(),
163 component.getSrcLoc());
169 if (parents.find(&component) != parents.end()) {
171 "Invalid cycle in inheritance for component " + component.getComponentType()->getName(),
172 component.getSrcLoc());
178 for (
const auto& cur : component.getComponents()) {
179 checkComponent(report, &component, componentLookup, *cur, activeBinding);
183 for (
const auto& cur : component.getInstantiations()) {
189 ErrorReport& report,
const Program& program,
const ComponentLookupAnalysis& componentLookup) {
190 for (Component* cur : program.getComponents()) {
191 checkComponent(report,
nullptr, componentLookup, *cur, TypeBinding());