Make it possible to evaluate JS with the v4 tool the QML way
authorSimon Hausmann <simon.hausmann@digia.com>
Mon, 17 Jun 2013 11:36:21 +0000 (13:36 +0200)
committerLars Knoll <lars.knoll@digia.com>
Mon, 17 Jun 2013 19:20:41 +0000 (21:20 +0200)
Change-Id: I2a40e82612c2da1b52a37cbff2507951e4ac0349
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
tools/v4/main.cpp

index 33c5ad7..e30fd8d 100644 (file)
@@ -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()) {