Skip to content

Commit 768cbba

Browse files
Fix for walking through DataDescriptorMatcher structure
Only visit the left node for operation 'not'. Additional small change for DataDescriptorMatcher created from ConcreteDataTypeMatcher to be in line with the structure used in all other cases.
1 parent b0dfbb8 commit 768cbba

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

Framework/Core/src/DataDescriptorMatcher.cxx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,8 @@ std::ostream& operator<<(std::ostream& os, DataDescriptorMatcher const& matcher)
454454
auto edgeWalker = overloaded{
455455
[&os](EdgeActions::EnterNode action) {
456456
os << "(" << action.node->mOp;
457-
if (action.node->mOp == DataDescriptorMatcher::Op::Just) {
457+
if (action.node->mOp == DataDescriptorMatcher::Op::Just ||
458+
action.node->mOp == DataDescriptorMatcher::Op::Not) {
458459
return ChildAction::VisitLeft;
459460
}
460461
return ChildAction::VisitBoth;

Framework/Core/src/DataSpecUtils.cxx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,8 @@ MatcherInfo extractMatcherInfo(DataDescriptorMatcher const& top)
334334
state.hasError = true;
335335
return VisitNone;
336336
}
337-
if (action.node->getOp() == ops::Just) {
337+
if (action.node->getOp() == ops::Just ||
338+
action.node->getOp() == ops::Not) {
338339
return VisitLeft;
339340
}
340341
return VisitBoth;
@@ -510,7 +511,8 @@ DataDescriptorMatcher DataSpecUtils::dataDescriptorMatcherFrom(ConcreteDataTypeM
510511
auto timeDescriptionMatcher = std::make_unique<DataDescriptorMatcher>(
511512
DataDescriptorMatcher::Op::And,
512513
DescriptionValueMatcher{dataType.description.as<std::string>()},
513-
StartTimeValueMatcher(ContextRef{0}));
514+
std::make_unique<DataDescriptorMatcher>(DataDescriptorMatcher::Op::Just,
515+
StartTimeValueMatcher{ContextRef{0}}));
514516
return std::move(DataDescriptorMatcher(
515517
DataDescriptorMatcher::Op::And,
516518
OriginValueMatcher{dataType.origin.as<std::string>()},
@@ -564,12 +566,11 @@ std::optional<framework::ConcreteDataMatcher> DataSpecUtils::optionalConcreteDat
564566
if (state.hasError) {
565567
return VisitNone;
566568
}
569+
// a ConcreteDataMatcher requires either 'and' or 'just'
570+
// operations and we return the corresponding action for these
567571
if (action.node->getOp() == ops::Just) {
568572
return VisitLeft;
569-
}
570-
// a ConcreteDataMatcher requires only 'and' operations
571-
// which have an OR, so we reset all the uniqueness attributes.
572-
if (action.node->getOp() == ops::And) {
573+
} else if (action.node->getOp() == ops::And) {
573574
return VisitBoth;
574575
}
575576
// simply use the error state to indicate that the operation does not match the

0 commit comments

Comments
 (0)