diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-09-12 15:27:01 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-18 13:13:49 +0200 |
commit | ce5dee24226f6abacaffe298092afe035d0822c4 (patch) | |
tree | 3b4dca1f091e47fcc0a235983853613f2f342726 /tools | |
parent | 16f92ad85cf665d863ded5eeaaa7fc3f90820b3f (diff) |
Convert more methods to use ReturnedValue
Change Exception.value() and a few other places.
Change-Id: I53ce17e5656e260138b1ac7f6d467e4636c0a0b9
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/v4/main.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/tools/v4/main.cpp b/tools/v4/main.cpp index b612a5d1ab..3404de2c30 100644 --- a/tools/v4/main.cpp +++ b/tools/v4/main.cpp @@ -117,9 +117,11 @@ DEFINE_MANAGED_VTABLE(GC); static void showException(QV4::ExecutionContext *ctx, const QV4::Exception &exception) { - QV4::ErrorObject *e = exception.value().asErrorObject(); + QV4::Scope scope(ctx); + QV4::ScopedValue ex(scope, exception.value()); + QV4::ErrorObject *e = ex->asErrorObject(); if (!e) { - std::cerr << "Uncaught exception: " << qPrintable(exception.value().toString(ctx)->toQString()) << std::endl; + std::cerr << "Uncaught exception: " << qPrintable(ex->toString(ctx)->toQString()) << std::endl; } else { std::cerr << "Uncaught exception: " << qPrintable(QV4::Value::fromReturnedValue(e->get(ctx->engine->newString(QStringLiteral("message")), 0)).toString(ctx)->toQString()) << std::endl; } @@ -187,6 +189,7 @@ int main(int argc, char *argv[]) QV4::ExecutionEngine vm(iSelFactory); QV4::ExecutionContext *ctx = vm.rootContext; + QV4::Scope scope(ctx); QV4::Object *globalObject = vm.globalObject; QV4::Object *print = new (ctx->engine->memoryManager) builtins::Print(ctx); @@ -204,10 +207,10 @@ int main(int argc, char *argv[]) QV4::Script script(ctx, code, fn); script.parseAsBinding = runAsQml; script.parse(); - QV4::Value result = script.run(); - if (!result.isUndefined()) { + QV4::ScopedValue result(scope, script.run()); + if (!result->isUndefined()) { if (! qgetenv("SHOW_EXIT_VALUE").isEmpty()) - std::cout << "exit value: " << qPrintable(result.toString(ctx)->toQString()) << std::endl; + std::cout << "exit value: " << qPrintable(result->toString(ctx)->toQString()) << std::endl; } } catch (QV4::Exception& ex) { ex.accept(ctx); |