Commit bc8e037c authored by Sebastian Nickels's avatar Sebastian Nickels
Browse files

Small changes to avoid endless loop when checking unresolved elements

parent ba82c2c3
Pipeline #180353 passed with stages
in 19 minutes and 40 seconds
......@@ -76,7 +76,7 @@ public class CheckIOAccessAndIOMissing extends CNNArchSymbolCoCo {
boolean isUnroll = false;
for (UnrollSymbol unroll : architecture.getUnrolls()) {
isUnroll = contains(unroll.getBody().getFirstAtomicElements(), ioElement);
isUnroll = contains(unroll.getBody(), ioElement);
}
// Allow invalid indices in UnrollSymbols
......@@ -101,18 +101,20 @@ public class CheckIOAccessAndIOMissing extends CNNArchSymbolCoCo {
}
private boolean contains(List<ArchitectureElementSymbol> list, ArchitectureElementSymbol element) {
boolean bool = false;
private boolean contains(ArchitectureElementSymbol element, ArchitectureElementSymbol containedElement) {
ArchitectureElementSymbol resolvedElement = (ArchitectureElementSymbol) element.getResolvedThis().get();
for (ArchitectureElementSymbol ele : list) {
if (ele.equals(element)) {
return true;
}
if (resolvedElement instanceof CompositeElementSymbol) {
List<ArchitectureElementSymbol> constructedElements = ((CompositeElementSymbol) resolvedElement).getElements();
bool |= contains(ele.getNext(), element);
for (ArchitectureElementSymbol constructedElement : constructedElements) {
if (contains(constructedElement, containedElement)) {
return true;
}
}
}
return bool;
return resolvedElement.equals(containedElement);
}
}
......@@ -52,7 +52,10 @@ public class CheckLayerVariableDeclarationIsUsed extends CNNArchSymbolCoCo {
}
for (UnrollSymbol unroll : layerVariableDeclaration.getLayer().getArchitecture().getUnrolls()) {
for (ArchitectureElementSymbol element : unroll.getBodiesForAllTimesteps().get(0).getElements()) {
Collection<ArchitectureElementSymbol> elements =
unroll.getBody().getSpannedScope().resolveMany(layerVariableDeclaration.getName(), ArchitectureElementSymbol.KIND);
for (ArchitectureElementSymbol element : elements) {
if (element instanceof VariableSymbol && ((VariableSymbol) element).getMember() == VariableSymbol.Member.NONE) {
isUsed = true;
break;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment