From 258c120d820f6d561d97f26ee165ec5c7386fb7b Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 17 Jun 2013 13:36:21 +0200 Subject: [PATCH] Make it possible to evaluate JS with the v4 tool the QML way Change-Id: I2a40e82612c2da1b52a37cbff2507951e4ac0349 Reviewed-by: Lars Knoll --- tools/v4/main.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/v4/main.cpp b/tools/v4/main.cpp index 33c5ad7365..e30fd8d21c 100644 --- a/tools/v4/main.cpp +++ b/tools/v4/main.cpp @@ -282,6 +282,7 @@ int main(int argc, char *argv[]) QQmlJS::LLVMOutputType fileType = QQmlJS::LLVMOutputObject; #endif // QMLJS_WITH_LLVM bool enableDebugging = false; + bool runAsQml = false; if (!args.isEmpty()) { if (args.first() == QLatin1String("-d") || args.first() == QLatin1String("--debug")) { @@ -301,6 +302,11 @@ int main(int argc, char *argv[]) args.removeFirst(); } + if (args.first() == QLatin1String("--qml")) { + runAsQml = true; + args.removeFirst(); + } + #ifdef QMLJS_WITH_LLVM if (args.first() == QLatin1String("--compile")) { mode = use_llvm_compiler; @@ -388,6 +394,7 @@ int main(int argc, char *argv[]) try { QV4::Script script(ctx, code, fn); + script.parseAsBinding = runAsQml; script.parse(); QV4::Value result = script.run(); if (!result.isUndefined()) {