diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/v4/main.cpp | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/tools/v4/main.cpp b/tools/v4/main.cpp index f6997eb7..d73fa480 100644 --- a/tools/v4/main.cpp +++ b/tools/v4/main.cpp @@ -369,30 +369,30 @@ int main(int argc, char *argv[]) const QString code = QString::fromUtf8(file.readAll()); file.close(); - void * buf = __qmljs_create_exception_handler(ctx); - if (setjmp(*(jmp_buf *)buf)) { + __qmljs_create_exception_handler(ctx); + try { + QQmlJS::VM::Function *f = QQmlJS::VM::EvalFunction::parseSource(ctx, fn, code, QQmlJS::Codegen::GlobalCode, + /*strictMode =*/ false, /*inheritContext =*/ false); + if (!f) + continue; + vm.globalCode = f; + + ctx->strictMode = f->isStrict; + ctx->lookups = f->lookups; + if (debugger) + debugger->aboutToCall(0, ctx); + QQmlJS::VM::Value result = f->code(ctx, f->codeData); + if (debugger) + debugger->justLeft(ctx); + if (!result.isUndefined()) { + if (! qgetenv("SHOW_EXIT_VALUE").isEmpty()) + std::cout << "exit value: " << qPrintable(result.toString(ctx)->toQString()) << std::endl; + } + } catch (const QQmlJS::VM::Exception&) { showException(ctx); return EXIT_FAILURE; } - QQmlJS::VM::Function *f = QQmlJS::VM::EvalFunction::parseSource(ctx, fn, code, QQmlJS::Codegen::GlobalCode, - /*strictMode =*/ false, /*inheritContext =*/ false); - if (!f) - continue; - vm.globalCode = f; - - ctx->strictMode = f->isStrict; - ctx->lookups = f->lookups; - if (debugger) - debugger->aboutToCall(0, ctx); - QQmlJS::VM::Value result = f->code(ctx, f->codeData); - if (debugger) - debugger->justLeft(ctx); - if (!result.isUndefined()) { - if (! qgetenv("SHOW_EXIT_VALUE").isEmpty()) - std::cout << "exit value: " << qPrintable(result.toString(ctx)->toQString()) << std::endl; - } - } else { std::cerr << "Error: cannot open file " << fn.toUtf8().constData() << std::endl; return EXIT_FAILURE; |