From 808fc26a78c1c0132019768a24c1060f56e4b7f2 Mon Sep 17 00:00:00 2001 From: Kaloian Manassiev Date: Thu, 18 Feb 2016 11:54:42 -0500 Subject: SERVER-9131 Fix lint failed checks --- src/mongo/scripting/mozjs/code.cpp | 15 ++++++--------- src/mongo/scripting/mozjs/code.h | 4 ++-- src/mongo/scripting/mozjs/implscope.h | 3 +-- src/mongo/scripting/mozjs/valuereader.cpp | 9 +++------ src/mongo/scripting/mozjs/valuewriter.cpp | 13 ++++++------- 5 files changed, 18 insertions(+), 26 deletions(-) (limited to 'src/mongo/scripting/mozjs') diff --git a/src/mongo/scripting/mozjs/code.cpp b/src/mongo/scripting/mozjs/code.cpp index 701ed1d0375..b042966908d 100644 --- a/src/mongo/scripting/mozjs/code.cpp +++ b/src/mongo/scripting/mozjs/code.cpp @@ -42,8 +42,7 @@ namespace mongo { namespace mozjs { const JSFunctionSpec CodeInfo::methods[2] = { - MONGO_ATTACH_JS_CONSTRAINED_METHOD(toString, CodeInfo), - JS_FS_END, + MONGO_ATTACH_JS_CONSTRAINED_METHOD(toString, CodeInfo), JS_FS_END, }; const char* const CodeInfo::className = "Code"; @@ -51,9 +50,9 @@ const char* const CodeInfo::className = "Code"; void CodeInfo::Functions::toString::call(JSContext* cx, JS::CallArgs args) { ObjectWrapper o(cx, args.thisv()); - std::string str = str::stream() - << "Code({\"code\":\"" << o.getString(InternedString::code) << "\"," - << "\"scope\":" << o.getObject(InternedString::scope) << "\"})"; + std::string str = str::stream() << "Code({\"code\":\"" << o.getString(InternedString::code) + << "\"," + << "\"scope\":" << o.getObject(InternedString::scope) << "\"})"; ValueReader(cx, args.rval()).fromStringData(str); } @@ -71,15 +70,13 @@ void CodeInfo::construct(JSContext* cx, JS::CallArgs args) { if (args.length() == 0) { o.setString(InternedString::code, ""); - } - else if (args.length() == 1) { + } else if (args.length() == 1) { JS::HandleValue codeArg = args.get(0); if (!codeArg.isString()) uasserted(ErrorCodes::BadValue, "code must be a string"); o.setValue(InternedString::code, codeArg); - } - else { + } else { if (!args.get(0).isString()) uasserted(ErrorCodes::BadValue, "code must be a string"); if (!args.get(1).isObject()) diff --git a/src/mongo/scripting/mozjs/code.h b/src/mongo/scripting/mozjs/code.h index a9d2e5523bb..048f3bcc5b0 100644 --- a/src/mongo/scripting/mozjs/code.h +++ b/src/mongo/scripting/mozjs/code.h @@ -51,5 +51,5 @@ struct CodeInfo : public BaseInfo { static const char* const className; }; -} // namespace mozjs -} // namespace mongo +} // namespace mozjs +} // namespace mongo diff --git a/src/mongo/scripting/mozjs/implscope.h b/src/mongo/scripting/mozjs/implscope.h index 26fd75fb574..be125f3e987 100644 --- a/src/mongo/scripting/mozjs/implscope.h +++ b/src/mongo/scripting/mozjs/implscope.h @@ -265,8 +265,7 @@ public: } template - typename std::enable_if::value, WrapType&>::type - getProto() { + typename std::enable_if::value, WrapType&>::type getProto() { return _codeProto; } diff --git a/src/mongo/scripting/mozjs/valuereader.cpp b/src/mongo/scripting/mozjs/valuereader.cpp index 630d446a4d0..bc1b61903ba 100644 --- a/src/mongo/scripting/mozjs/valuereader.cpp +++ b/src/mongo/scripting/mozjs/valuereader.cpp @@ -61,8 +61,7 @@ void ValueReader::fromBSONElement(const BSONElement& elem, const BSONObj& parent JS::RootedObject obj(_context); scope->getProto().newInstance(args, _value); - } - else { + } else { scope->newFunction(elem.valueStringData(), _value); } return; @@ -71,12 +70,10 @@ void ValueReader::fromBSONElement(const BSONElement& elem, const BSONObj& parent JS::AutoValueArray<2> args(_context); ValueReader(_context, args[0]).fromStringData(elem.valueStringData()); - ValueReader(_context, args[1]).fromBSON(elem.codeWScopeObject(), - nullptr, readOnly); + ValueReader(_context, args[1]).fromBSON(elem.codeWScopeObject(), nullptr, readOnly); scope->getProto().newInstance(args, _value); - } - else { + } else { if (!elem.codeWScopeObject().isEmpty()) warning() << "CodeWScope doesn't transfer to db.eval"; scope->newFunction(StringData(elem.codeWScopeCode(), elem.codeWScopeCodeLen() - 1), diff --git a/src/mongo/scripting/mozjs/valuewriter.cpp b/src/mongo/scripting/mozjs/valuewriter.cpp index 967a2947cd8..8767c7e83ac 100644 --- a/src/mongo/scripting/mozjs/valuewriter.cpp +++ b/src/mongo/scripting/mozjs/valuewriter.cpp @@ -267,17 +267,16 @@ void ValueWriter::_writeObject(BSONObjBuilder* b, } if (scope->getProto().getJSClass() == jsclass) { - if (o.hasOwnField(InternedString::scope) // CodeWScope - && o.type(InternedString::scope) == mongo::Object) { - + if (o.hasOwnField(InternedString::scope) // CodeWScope + && + o.type(InternedString::scope) == mongo::Object) { if (o.type(InternedString::code) != mongo::String) { uasserted(ErrorCodes::BadValue, "code must be a string"); } - b->appendCodeWScope(sd, o.getString(InternedString::code), - o.getObject(InternedString::scope)); - } - else { // Code + b->appendCodeWScope( + sd, o.getString(InternedString::code), o.getObject(InternedString::scope)); + } else { // Code if (o.type(InternedString::code) != mongo::String) { uasserted(ErrorCodes::BadValue, "code must be a string"); } -- cgit v1.2.1