Skip to content

Commit

Permalink
Improve error behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
msujew committed Dec 4, 2024
1 parent 84fcc61 commit 8c55dd0
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ function findNextFeaturesInternal(options: { next: NextFeature, cardinalities: M
const feature = next.feature;
if (visited.has(feature)) {
return [];
} else if (!ast.isGroup(feature)) {
// Do not add the feature to the list if it is a group
// `findFirstFeaturesInternal` will take care of this
visited.add(feature);
}
let parent: ast.Group | undefined;
let item = feature;
Expand Down Expand Up @@ -130,8 +134,6 @@ function findFirstFeaturesInternal(options: { next: NextFeature, cardinalities:
} else {
visited.add(feature);
}
}
if (ast.isGroup(feature)) {
return findNextFeaturesInGroup(next as NextFeature<ast.Group>, 0, cardinalities, visited, plus)
.map(e => modifyCardinality(e, feature.cardinality, cardinalities));
} else if (ast.isAlternatives(feature) || ast.isUnorderedGroup(feature)) {
Expand Down

0 comments on commit 8c55dd0

Please sign in to comment.