aboutsummaryrefslogtreecommitdiffstats
path: root/main.cpp
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@digia.com>2012-11-20 09:47:18 +0100
committerLars Knoll <lars.knoll@digia.com>2012-11-20 12:04:10 +0100
commit3780a47c4654d228933eeecef036d1b7963e256a (patch)
tree13fcb1955e90c79cb6fc0908844b725acda9247e /main.cpp
parente625c28b3957c680baea7127c079f9497fa11f0f (diff)
Make LLVM backend compile again.
Moved common code into a separate function. Change-Id: Iaa96c27214659a23b3df70b80560fb8f42792b38 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/main.cpp b/main.cpp
index c9e31701a7..4753279d2b 100644
--- a/main.cpp
+++ b/main.cpp
@@ -106,6 +106,14 @@ struct TestHarnessError: FunctionObject
} // builtins
+static void showException(QQmlJS::VM::ExecutionContext *ctx)
+{
+ if (QQmlJS::VM::ErrorObject *e = ctx->engine->exception.asErrorObject())
+ std::cerr << "Uncaught exception: " << qPrintable(e->value.toString(ctx)->toQString()) << std::endl;
+ else
+ std::cerr << "Uncaught exception: " << qPrintable(ctx->engine->exception.toString(ctx)->toQString()) << std::endl;
+}
+
#ifndef QMLJS_NO_LLVM
int executeLLVMCode(void *codePtr)
{
@@ -125,10 +133,7 @@ int executeLLVMCode(void *codePtr)
void * buf = __qmljs_create_exception_handler(ctx);
if (setjmp(*(jmp_buf *)buf)) {
- if (VM::ErrorObject *e = ctx->result.asErrorObject())
- std::cerr << "Uncaught exception: " << qPrintable(e->value.toString(ctx)->toQString()) << std::endl;
- else
- std::cerr << "Uncaught exception: " << qPrintable(ctx->result.toString(ctx)->toQString()) << std::endl;
+ showException(ctx);
return EXIT_FAILURE;
}
@@ -309,10 +314,7 @@ int main(int argc, char *argv[])
void * buf = __qmljs_create_exception_handler(ctx);
if (setjmp(*(jmp_buf *)buf)) {
- if (QQmlJS::VM::ErrorObject *e = ctx->engine->exception.asErrorObject())
- std::cerr << "Uncaught exception: " << qPrintable(e->value.toString(ctx)->toQString()) << std::endl;
- else
- std::cerr << "Uncaught exception: " << qPrintable(ctx->engine->exception.toString(ctx)->toQString()) << std::endl;
+ showException(ctx);
return EXIT_FAILURE;
}