summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2013-02-14 12:29:16 +0100
committerLars Knoll <lars.knoll@digia.com>2013-02-14 12:33:47 +0100
commit63cd0f745bb5a3baf47046b8453159cf34b0a23a (patch)
treed1734ea24e886f3e78947e357d54de0c888dc08e /tools
parent2008f2bd376556a328eb3778198d1cfbc5d09466 (diff)
Fix print and gc in builtin v4 method
Also removed unused TestHarness stuff. Change-Id: I6332d9a34f471df07cfa0e9709a203e99a48b524 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/v4/main.cpp38
1 files changed, 4 insertions, 34 deletions
diff --git a/tools/v4/main.cpp b/tools/v4/main.cpp
index 01d4f8fd..7a6e7361 100644
--- a/tools/v4/main.cpp
+++ b/tools/v4/main.cpp
@@ -77,10 +77,10 @@ struct Print: FunctionObject
name = scope->engine->newString("print");
}
- virtual Value call(ExecutionContext *ctx)
+ virtual Value call(ExecutionContext *ctx, Value, Value *args, int argc)
{
- for (unsigned int i = 0; i < ctx->argumentCount; ++i) {
- String *s = ctx->argument(i).toString(ctx);
+ for (int i = 0; i < argc; ++i) {
+ String *s = args[i].toString(ctx);
if (i)
std::cout << ' ';
std::cout << qPrintable(s->toQString());
@@ -90,29 +90,6 @@ struct Print: FunctionObject
}
};
-struct TestHarnessError: FunctionObject
-{
- TestHarnessError(ExecutionContext *scope, bool &errorInTestHarness): FunctionObject(scope), errorOccurred(errorInTestHarness) {
- name = scope->engine->newString("$ERROR");
- }
-
- virtual Value call(ExecutionContext *ctx)
- {
- errorOccurred = true;
-
- for (unsigned int i = 0; i < ctx->argumentCount; ++i) {
- String *s = ctx->argument(i).toString(ctx);
- if (i)
- std::cerr << ' ';
- std::cerr << qPrintable(s->toQString());
- }
- std::cerr << std::endl;
- return Value::undefinedValue();
- }
-
- bool &errorOccurred;
-};
-
struct GC: public FunctionObject
{
GC(ExecutionContext* scope)
@@ -120,7 +97,7 @@ struct GC: public FunctionObject
{
name = scope->engine->newString("gc");
}
- virtual Value call(ExecutionContext *ctx)
+ virtual Value call(ExecutionContext *ctx, Value, Value *, int)
{
ctx->engine->memoryManager->runGC();
return Value::undefinedValue();
@@ -376,11 +353,6 @@ int main(int argc, char *argv[])
globalObject->__put__(ctx, vm.newIdentifier(QStringLiteral("gc")),
QQmlJS::VM::Value::fromObject(gc));
- bool errorInTestHarness = false;
- if (!qgetenv("IN_TEST_HARNESS").isEmpty())
- globalObject->__put__(ctx, vm.newIdentifier(QStringLiteral("$ERROR")),
- QQmlJS::VM::Value::fromObject(new (ctx->engine->memoryManager) builtins::TestHarnessError(ctx, errorInTestHarness)));
-
foreach (const QString &fn, args) {
QFile file(fn);
if (file.open(QFile::ReadOnly)) {
@@ -411,8 +383,6 @@ int main(int argc, char *argv[])
std::cout << "exit value: " << qPrintable(result.toString(ctx)->toQString()) << std::endl;
}
- if (errorInTestHarness)
- return EXIT_FAILURE;
} else {
std::cerr << "Error: cannot open file " << fn.toUtf8().constData() << std::endl;
return EXIT_FAILURE;