diff options
Diffstat (limited to 'src/mongo/db/matcher/expression_leaf.cpp')
-rw-r--r-- | src/mongo/db/matcher/expression_leaf.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/mongo/db/matcher/expression_leaf.cpp b/src/mongo/db/matcher/expression_leaf.cpp index 18f850ac1e3..d73a611963b 100644 --- a/src/mongo/db/matcher/expression_leaf.cpp +++ b/src/mongo/db/matcher/expression_leaf.cpp @@ -54,8 +54,10 @@ ComparisonMatchExpressionBase::ComparisonMatchExpressionBase( StringData path, const BSONElement& rhs, ElementPath::LeafArrayBehavior leafArrBehavior, - ElementPath::NonLeafArrayBehavior nonLeafArrBehavior) - : LeafMatchExpression(type, path, leafArrBehavior, nonLeafArrBehavior), _rhs(rhs) { + ElementPath::NonLeafArrayBehavior nonLeafArrBehavior, + clonable_ptr<ErrorAnnotation> annotation) + : LeafMatchExpression(type, path, leafArrBehavior, nonLeafArrBehavior, std::move(annotation)), + _rhs(rhs) { invariant(_rhs); } @@ -93,12 +95,14 @@ BSONObj ComparisonMatchExpressionBase::getSerializedRightHandSide() const { ComparisonMatchExpression::ComparisonMatchExpression(MatchType type, StringData path, - const BSONElement& rhs) + const BSONElement& rhs, + clonable_ptr<ErrorAnnotation> annotation) : ComparisonMatchExpressionBase(type, path, rhs, ElementPath::LeafArrayBehavior::kTraverse, - ElementPath::NonLeafArrayBehavior::kTraverse) { + ElementPath::NonLeafArrayBehavior::kTraverse, + std::move(annotation)) { uassert( ErrorCodes::BadValue, "cannot compare to undefined", _rhs.type() != BSONType::Undefined); @@ -368,12 +372,12 @@ bool ExistsMatchExpression::equivalent(const MatchExpression* other) const { // ---- -InMatchExpression::InMatchExpression(StringData path) - : LeafMatchExpression(MATCH_IN, path), +InMatchExpression::InMatchExpression(StringData path, clonable_ptr<ErrorAnnotation> annotation) + : LeafMatchExpression(MATCH_IN, path, std::move(annotation)), _eltCmp(BSONElementComparator::FieldNamesMode::kIgnore, _collator) {} std::unique_ptr<MatchExpression> InMatchExpression::shallowClone() const { - auto next = std::make_unique<InMatchExpression>(path()); + auto next = std::make_unique<InMatchExpression>(path(), _errorAnnotation); next->setCollator(_collator); if (getTag()) { next->setTag(getTag()->clone()); |