diff options
author | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2017-11-20 13:57:09 -0500 |
---|---|---|
committer | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2017-11-20 13:57:09 -0500 |
commit | 015781fb73e66e99abcb2ceb998d22a79d915227 (patch) | |
tree | 01ab53ed7a365790ec70817aeb099bb65bc1dd7d /src/mongo/idl/idl_parser.cpp | |
parent | 88b413760e2fa91b03267412c8d36a207975fd9e (diff) | |
download | mongo-015781fb73e66e99abcb2ceb998d22a79d915227.tar.gz |
SERVER-32005 IDL augment code with compiler likely macro
Diffstat (limited to 'src/mongo/idl/idl_parser.cpp')
-rw-r--r-- | src/mongo/idl/idl_parser.cpp | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/src/mongo/idl/idl_parser.cpp b/src/mongo/idl/idl_parser.cpp index 1de7730b780..888ea2894bd 100644 --- a/src/mongo/idl/idl_parser.cpp +++ b/src/mongo/idl/idl_parser.cpp @@ -63,29 +63,26 @@ std::string toCommaDelimitedList(const std::vector<BSONType>& types) { constexpr StringData IDLParserErrorContext::kOpMsgDollarDBDefault; constexpr StringData IDLParserErrorContext::kOpMsgDollarDB; -bool IDLParserErrorContext::checkAndAssertType(const BSONElement& element, BSONType type) const { +bool IDLParserErrorContext::checkAndAssertTypeSlowPath(const BSONElement& element, + BSONType type) const { auto elementType = element.type(); - if (elementType != type) { - // If the type is wrong, ignore Null and Undefined values - if (elementType == jstNULL || elementType == Undefined) { - return false; - } - - std::string path = getElementPath(element); - uasserted(ErrorCodes::TypeMismatch, - str::stream() << "BSON field '" << path << "' is the wrong type '" - << typeName(element.type()) - << "', expected type '" - << typeName(type) - << "'"); + // If the type is wrong, ignore Null and Undefined values + if (elementType == jstNULL || elementType == Undefined) { + return false; } - return true; + std::string path = getElementPath(element); + uasserted(ErrorCodes::TypeMismatch, + str::stream() << "BSON field '" << path << "' is the wrong type '" + << typeName(elementType) + << "', expected type '" + << typeName(type) + << "'"); } -bool IDLParserErrorContext::checkAndAssertBinDataType(const BSONElement& element, - BinDataType type) const { +bool IDLParserErrorContext::checkAndAssertBinDataTypeSlowPath(const BSONElement& element, + BinDataType type) const { bool isBinDataType = checkAndAssertType(element, BinData); if (!isBinDataType) { return false; |