Make it possible to evaluate JS with the v4 tool the QML way
Change-Id: I2a40e82612c2da1b52a37cbff2507951e4ac0349 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
This commit is contained in:
parent
530769c9ff
commit
258c120d82
|
@ -282,6 +282,7 @@ int main(int argc, char *argv[])
|
||||||
QQmlJS::LLVMOutputType fileType = QQmlJS::LLVMOutputObject;
|
QQmlJS::LLVMOutputType fileType = QQmlJS::LLVMOutputObject;
|
||||||
#endif // QMLJS_WITH_LLVM
|
#endif // QMLJS_WITH_LLVM
|
||||||
bool enableDebugging = false;
|
bool enableDebugging = false;
|
||||||
|
bool runAsQml = false;
|
||||||
|
|
||||||
if (!args.isEmpty()) {
|
if (!args.isEmpty()) {
|
||||||
if (args.first() == QLatin1String("-d") || args.first() == QLatin1String("--debug")) {
|
if (args.first() == QLatin1String("-d") || args.first() == QLatin1String("--debug")) {
|
||||||
|
@ -301,6 +302,11 @@ int main(int argc, char *argv[])
|
||||||
args.removeFirst();
|
args.removeFirst();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (args.first() == QLatin1String("--qml")) {
|
||||||
|
runAsQml = true;
|
||||||
|
args.removeFirst();
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef QMLJS_WITH_LLVM
|
#ifdef QMLJS_WITH_LLVM
|
||||||
if (args.first() == QLatin1String("--compile")) {
|
if (args.first() == QLatin1String("--compile")) {
|
||||||
mode = use_llvm_compiler;
|
mode = use_llvm_compiler;
|
||||||
|
@ -388,6 +394,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
try {
|
try {
|
||||||
QV4::Script script(ctx, code, fn);
|
QV4::Script script(ctx, code, fn);
|
||||||
|
script.parseAsBinding = runAsQml;
|
||||||
script.parse();
|
script.parse();
|
||||||
QV4::Value result = script.run();
|
QV4::Value result = script.run();
|
||||||
if (!result.isUndefined()) {
|
if (!result.isUndefined()) {
|
||||||
|
|
Loading…
Reference in New Issue