fix where on v8 SERVER-864

This commit is contained in:
Eliot Horowitz
2010-04-08 15:26:12 -04:00
parent 0efadc48e9
commit 48d2acc0de
4 changed files with 16 additions and 10 deletions

View File

@@ -421,5 +421,15 @@ namespace mongo {
void ( *ScriptEngine::_connectCallback )( DBClientWithCommands & ) = 0;
ScriptEngine * globalScriptEngine;
bool hasJSReturn( const string& code ){
size_t x = code.find( "return" );
if ( x == string::npos )
return false;
return
( x == 0 || ! isalpha( code[x-1] ) ) &&
! isalpha( code[x+6] );
}
}