Changeset 94811 in webkit for trunk/Source/JavaScriptCore/runtime/Completion.cpp
- Timestamp:
- Sep 8, 2011, 3:38:44 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/runtime/Completion.cpp
r91095 r94811 35 35 namespace JSC { 36 36 37 Completion checkSyntax(ExecState* exec, const SourceCode& source)37 bool checkSyntax(ExecState* exec, const SourceCode& source, JSValue* returnedException) 38 38 { 39 39 JSLock lock(exec); … … 42 42 ProgramExecutable* program = ProgramExecutable::create(exec, source); 43 43 JSObject* error = program->checkSyntax(exec); 44 if (error) 45 return Completion(Throw, error); 44 if (error) { 45 if (returnedException) 46 *returnedException = error; 47 return false; 48 } 46 49 47 return Completion(Normal);50 return true; 48 51 } 49 52 50 Completion evaluate(ExecState* exec, ScopeChainNode* scopeChain, const SourceCode& source, JSValue thisValue)53 JSValue evaluate(ExecState* exec, ScopeChainNode* scopeChain, const SourceCode& source, JSValue thisValue, JSValue* returnedException) 51 54 { 52 55 JSLock lock(exec); … … 55 58 ProgramExecutable* program = ProgramExecutable::create(exec, source); 56 59 if (!program) { 57 JSValue exception = exec->globalData().exception; 60 if (returnedException) 61 *returnedException = exec->globalData().exception; 62 58 63 exec->globalData().exception = JSValue(); 59 return Completion(Throw, exception);64 return jsUndefined(); 60 65 } 61 66 … … 63 68 thisValue = exec->dynamicGlobalObject(); 64 69 JSObject* thisObj = thisValue.toThisObject(exec); 65 66 70 JSValue result = exec->interpreter()->execute(program, exec, scopeChain, thisObj); 67 71 68 72 if (exec->hadException()) { 69 JSValue exception = exec->exception(); 73 if (returnedException) 74 *returnedException = exec->exception(); 75 70 76 exec->clearException(); 77 return jsUndefined(); 78 } 71 79 72 ComplType exceptionType = Throw; 73 if (exception.isObject()) 74 exceptionType = asObject(exception)->exceptionType(); 75 return Completion(exceptionType, exception); 76 } 77 return Completion(Normal, result); 80 ASSERT(result); 81 return result; 78 82 } 79 83
Note:
See TracChangeset
for help on using the changeset viewer.