summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2016-02-18 11:54:42 -0500
committerRamon Fernandez <ramon@mongodb.com>2016-02-24 11:38:56 -0500
commit57806ce43bf5c529162f1ccfea139043444fcb40 (patch)
tree49fc62ab35852fd6cf9f53bbcaad7ea4bfb81914
parent80ce9795b518b741a5e9236224a50db00abd7096 (diff)
downloadmongo-57806ce43bf5c529162f1ccfea139043444fcb40.tar.gz
SERVER-9131 Fix lint failed checks
(cherry picked from commit 808fc26a78c1c0132019768a24c1060f56e4b7f2)
-rw-r--r--src/mongo/scripting/mozjs/code.cpp15
-rw-r--r--src/mongo/scripting/mozjs/code.h4
-rw-r--r--src/mongo/scripting/mozjs/implscope.h3
-rw-r--r--src/mongo/scripting/mozjs/valuereader.cpp9
-rw-r--r--src/mongo/scripting/mozjs/valuewriter.cpp13
5 files changed, 18 insertions, 26 deletions
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 T>
- typename std::enable_if<std::is_same<T, CodeInfo>::value, WrapType<T>&>::type
- getProto() {
+ typename std::enable_if<std::is_same<T, CodeInfo>::value, WrapType<T>&>::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<CodeInfo>().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<CodeInfo>().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 4524ce9d9f4..0b02a945a41 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<CodeInfo>().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");
}