ScriptingFunction Scope::createFunction( const char * code ){ if ( code[0] == '/' && code [1] == '*' ){ code += 2; while ( code[0] && code[1] ){ if ( code[0] == '*' && code[1] == '/' ){ code += 2; break; } code++; } } map<string,ScriptingFunction>::iterator i = _cachedFunctions.find( code ); if ( i != _cachedFunctions.end() ) return i->second; ScriptingFunction f = _createFunction( code ); _cachedFunctions[code] = f; return f; }
ScriptingFunction Scope::createFunction(const char* code) { if (code[0] == '/' && code [1] == '*') { code += 2; while (code[0] && code[1]) { if (code[0] == '*' && code[1] == '/') { code += 2; break; } code++; } } map<string, ScriptingFunction>::iterator i = _cachedFunctions.find(code); if (i != _cachedFunctions.end()) return i->second; // NB: we calculate the function number for v8 so the cache can be utilized to // lookup the source on an exception, but SpiderMonkey uses the value // returned by JS_CompileFunction. ScriptingFunction functionNumber = getFunctionCache().size() + 1; _cachedFunctions[code] = functionNumber; ScriptingFunction f = _createFunction(code, functionNumber); return f; }
Connection *ConnectionType::create(void) { return _createFunction(); }