diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-09-18 15:34:13 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-22 01:06:20 +0200 |
commit | 700ba1bcb39e082049c96fafdfaccfe5d83cd77e (patch) | |
tree | d21da27b94a927377ba2c6efd7c3af731d890b19 /src/qml/jsruntime/qv4jsonobject.cpp | |
parent | 1aa618970a9bed46123d0648500e957688d725ec (diff) |
Use a StringRef for Managed::get()
also store "toString" and "valueOf" as identifiers
in the engine and fix two places where we compared
strings the wrong way.
Change-Id: I70612221e72d43ed0e3c496e4209681bf254cded
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4jsonobject.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4jsonobject.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/qml/jsruntime/qv4jsonobject.cpp b/src/qml/jsruntime/qv4jsonobject.cpp index d67daff07f..6dec2d1ec6 100644 --- a/src/qml/jsruntime/qv4jsonobject.cpp +++ b/src/qml/jsruntime/qv4jsonobject.cpp @@ -702,10 +702,10 @@ static QString quote(const QString &str) QString Stringify::Str(const QString &key, Value value) { Scope scope(ctx); - QString result; if (Object *o = value.asObject()) { - Scoped<FunctionObject> toJSON(scope, o->get(ctx->engine->newString(QStringLiteral("toJSON")))); + ScopedString s(scope, ctx->engine->newString(QStringLiteral("toJSON"))); + Scoped<FunctionObject> toJSON(scope, o->get(s)); if (!!toJSON) { ScopedCallData callData(scope, 1); callData->thisObject = value; @@ -798,12 +798,14 @@ QString Stringify::JO(Object *o) partial += member; } } else { + ScopedString s(scope); for (int i = 0; i < propertyList.size(); ++i) { bool exists; - ScopedValue v(scope, o->get(propertyList.at(i), &exists)); + s = propertyList.at(i); + ScopedValue v(scope, o->get(s, &exists)); if (!exists) continue; - QString member = makeMember(propertyList.at(i)->toQString(), v); + QString member = makeMember(s->toQString(), v); if (!member.isEmpty()) partial += member; } |