diff options
author | Lars Knoll <[email protected]> | 2015-04-28 18:09:11 +0200 |
---|---|---|
committer | Simon Hausmann <[email protected]> | 2015-06-15 18:26:59 +0000 |
commit | 76e61ded19931f45e9519a284f1af9d0782004c6 (patch) | |
tree | fdd999e8515fcd3c93ca19e7ab6dd2aac9d1db4d /src/qml/jsruntime/qv4jsonobject.cpp | |
parent | a9021009ab295d89e210821693c7f5bd733ccc35 (diff) |
Cleanup: Store a pointer to the engine not the context
The context is actually only ever used to get to the engine,
so let's rather store that one instead.
Change-Id: Id6ea8044ac3fb2c273b529f18c85af14e7104892
Reviewed-by: Simon Hausmann <[email protected]>
Diffstat (limited to 'src/qml/jsruntime/qv4jsonobject.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4jsonobject.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/qml/jsruntime/qv4jsonobject.cpp b/src/qml/jsruntime/qv4jsonobject.cpp index 815376c200..56750f75c8 100644 --- a/src/qml/jsruntime/qv4jsonobject.cpp +++ b/src/qml/jsruntime/qv4jsonobject.cpp @@ -612,7 +612,7 @@ bool JsonParser::parseString(QString *string) struct Stringify { - ExecutionContext *ctx; + ExecutionEngine *v4; FunctionObject *replacerFunction; // ### GC QVector<Heap::String *> propertyList; @@ -622,7 +622,7 @@ struct Stringify // ### GC QStack<Heap::Object *> stack; - Stringify(ExecutionContext *ctx) : ctx(ctx), replacerFunction(0) {} + Stringify(ExecutionEngine *e) : v4(e), replacerFunction(0) {} QString Str(const QString &key, const Value &v); QString JA(ArrayObject *a); @@ -674,26 +674,26 @@ static QString quote(const QString &str) QString Stringify::Str(const QString &key, const Value &v) { - Scope scope(ctx); + Scope scope(v4); ScopedValue value(scope, v); ScopedObject o(scope, value); if (o) { - ScopedString s(scope, ctx->d()->engine->newString(QStringLiteral("toJSON"))); + ScopedString s(scope, v4->newString(QStringLiteral("toJSON"))); ScopedFunctionObject toJSON(scope, o->get(s)); if (!!toJSON) { ScopedCallData callData(scope, 1); callData->thisObject = value; - callData->args[0] = ctx->d()->engine->newString(key); + callData->args[0] = v4->newString(key); value = toJSON->call(callData); } } if (replacerFunction) { - ScopedObject holder(scope, ctx->d()->engine->newObject()); + ScopedObject holder(scope, v4->newObject()); holder->put(scope.engine, QString(), value); ScopedCallData callData(scope, 2); - callData->args[0] = ctx->d()->engine->newString(key); + callData->args[0] = v4->newString(key); callData->args[1] = value; callData->thisObject = holder; value = replacerFunction->call(callData); @@ -751,11 +751,11 @@ QString Stringify::makeMember(const QString &key, const Value &v) QString Stringify::JO(Object *o) { if (stack.contains(o->d())) { - ctx->engine()->throwTypeError(); + v4->throwTypeError(); return QString(); } - Scope scope(ctx); + Scope scope(v4); QString result; stack.push(o->d()); @@ -808,7 +808,7 @@ QString Stringify::JO(Object *o) QString Stringify::JA(ArrayObject *a) { if (stack.contains(a->d())) { - ctx->engine()->throwTypeError(); + v4->throwTypeError(); return QString(); } @@ -884,7 +884,7 @@ ReturnedValue JsonObject::method_stringify(CallContext *ctx) { Scope scope(ctx); - Stringify stringify(ctx); + Stringify stringify(scope.engine); ScopedObject o(scope, ctx->argument(1)); if (o) { |