X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/2d39b0e377c0896910ee49ae70082ba665faf986..ed1e77d3adeb83d26fd1dfb16dd84cabdcefd250:/runtime/Completion.cpp diff --git a/runtime/Completion.cpp b/runtime/Completion.cpp index c414570..f67bc57 100644 --- a/runtime/Completion.cpp +++ b/runtime/Completion.cpp @@ -26,6 +26,7 @@ #include "CallFrame.h" #include "CodeProfiling.h" #include "Debugger.h" +#include "Exception.h" #include "Interpreter.h" #include "JSGlobalObject.h" #include "JSLock.h" @@ -55,11 +56,12 @@ bool checkSyntax(VM& vm, const SourceCode& source, ParserError& error) { JSLockHolder lock(vm); RELEASE_ASSERT(vm.atomicStringTable() == wtfThreadData().atomicStringTable()); - RefPtr programNode = parse(&vm, source, 0, Identifier(), JSParseNormal, JSParseProgramCode, error); - return programNode; + return !!parse( + &vm, source, 0, Identifier(), JSParserBuiltinMode::NotBuiltin, + JSParserStrictMode::NotStrict, JSParserCodeType::Program, error); } -JSValue evaluate(ExecState* exec, const SourceCode& source, JSValue thisValue, JSValue* returnedException) +JSValue evaluate(ExecState* exec, const SourceCode& source, JSValue thisValue, NakedPtr& returnedException) { JSLockHolder lock(exec); RELEASE_ASSERT(exec->vm().atomicStringTable() == wtfThreadData().atomicStringTable()); @@ -69,9 +71,7 @@ JSValue evaluate(ExecState* exec, const SourceCode& source, JSValue thisValue, J ProgramExecutable* program = ProgramExecutable::create(exec, source); if (!program) { - if (returnedException) - *returnedException = exec->vm().exception(); - + returnedException = exec->vm().exception(); exec->vm().clearException(); return jsUndefined(); } @@ -82,9 +82,7 @@ JSValue evaluate(ExecState* exec, const SourceCode& source, JSValue thisValue, J JSValue result = exec->interpreter()->execute(program, exec, thisObj); if (exec->hadException()) { - if (returnedException) - *returnedException = exec->exception(); - + returnedException = exec->exception(); exec->clearException(); return jsUndefined(); }