mirror of
https://github.com/mongodb/mongo.git
synced 2024-11-30 09:06:21 +01:00
fix return for simple expr.
This commit is contained in:
parent
bd840cf7b0
commit
6c10cf4d98
@ -98,6 +98,11 @@ namespace mongo {
|
||||
|
||||
string code = raw;
|
||||
if ( code.find( "function" ) == string::npos ){
|
||||
if ( code.find( "\n" ) == string::npos &&
|
||||
code.find( "return" ) == string::npos &&
|
||||
( code.find( ";" ) == string::npos || code.find( ";" ) == code.size() - 1 ) ){
|
||||
code = "return " + code;
|
||||
}
|
||||
code = "function(){ " + code + "}";
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user