summaryrefslogtreecommitdiff
path: root/src/mongo/idl/idl_parser.cpp
diff options
context:
space:
mode:
authorMark Benvenuto <mark.benvenuto@mongodb.com>2017-11-20 13:57:09 -0500
committerMark Benvenuto <mark.benvenuto@mongodb.com>2017-11-20 13:57:09 -0500
commit015781fb73e66e99abcb2ceb998d22a79d915227 (patch)
tree01ab53ed7a365790ec70817aeb099bb65bc1dd7d /src/mongo/idl/idl_parser.cpp
parent88b413760e2fa91b03267412c8d36a207975fd9e (diff)
downloadmongo-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.cpp31
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;