mirror of
https://github.com/mongodb/mongo.git
synced 2024-11-30 00:56:44 +01:00
fix comment parsing in v8
This commit is contained in:
parent
4da350d1f6
commit
4e51d779c6
@ -457,5 +457,20 @@ namespace mongo {
|
||||
( x == 0 || ! isalpha( code[x-1] ) ) &&
|
||||
! isalpha( code[x+6] );
|
||||
}
|
||||
|
||||
const char * jsSkipWhiteSpace( const char * raw ){
|
||||
while ( raw[0] ){
|
||||
while (isspace(*raw)) {
|
||||
raw++;
|
||||
}
|
||||
|
||||
if ( raw[0] != '/' || raw[1] != '/' )
|
||||
break;
|
||||
|
||||
while ( raw[0] && raw[0] != '\n' )
|
||||
raw++;
|
||||
}
|
||||
return raw;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -234,5 +234,7 @@ namespace mongo {
|
||||
|
||||
bool hasJSReturn( const string& s );
|
||||
|
||||
const char * jsSkipWhiteSpace( const char * raw );
|
||||
|
||||
extern ScriptEngine * globalScriptEngine;
|
||||
}
|
||||
|
@ -427,18 +427,8 @@ namespace mongo {
|
||||
JSFunction * _compileFunction( const char * raw , JSObject * assoc , const char *& gcName ){
|
||||
if ( ! assoc )
|
||||
assoc = JS_GetGlobalObject( _context );
|
||||
|
||||
while ( raw[0] ){
|
||||
while (isspace(*raw)) {
|
||||
raw++;
|
||||
}
|
||||
|
||||
if ( raw[0] != '/' || raw[1] != '/' )
|
||||
break;
|
||||
|
||||
while ( raw[0] && raw[0] != '\n' )
|
||||
raw++;
|
||||
}
|
||||
raw = jsSkipWhiteSpace( raw );
|
||||
|
||||
//cout << "RAW\n---\n" << raw << "\n---" << endl;
|
||||
|
||||
|
@ -258,7 +258,7 @@ namespace mongo {
|
||||
}
|
||||
|
||||
Local< v8::Function > V8Scope::__createFunction( const char * raw ){
|
||||
for(; isspace( *raw ); ++raw ); // skip whitespace
|
||||
raw = jsSkipWhiteSpace( raw );
|
||||
string code = raw;
|
||||
if ( !hasFunctionIdentifier( code ) ) {
|
||||
if ( code.find( "\n" ) == string::npos &&
|
||||
|
Loading…
Reference in New Issue
Block a user