diff options
author | Lars Knoll <[email protected]> | 2016-11-24 16:05:14 +0100 |
---|---|---|
committer | Lars Knoll <[email protected]> | 2016-11-29 20:00:18 +0000 |
commit | 5d35573a62686aa3b0c45fc032b79670d88ebba9 (patch) | |
tree | 7e60a301e347ba073d2d310c59083b18eeaa922f /src/qml/jsruntime/qv4jsonobject.cpp | |
parent | a36d19546891a808cf71dbb084d6d63870d2b8ec (diff) |
Clean up Value::isString()/stringValue() combinations
It's enough to just call stringValue(), as that already
does the isString() check.
Change-Id: I7be0e643a7975c0704b4c9c43b337deb8db9fce0
Reviewed-by: Simon Hausmann <[email protected]>
Diffstat (limited to 'src/qml/jsruntime/qv4jsonobject.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4jsonobject.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/qml/jsruntime/qv4jsonobject.cpp b/src/qml/jsruntime/qv4jsonobject.cpp index 6a01f207c4..d79e6242ba 100644 --- a/src/qml/jsruntime/qv4jsonobject.cpp +++ b/src/qml/jsruntime/qv4jsonobject.cpp @@ -727,8 +727,8 @@ QString Stringify::Str(const QString &key, const Value &v) return QStringLiteral("null"); if (scope.result.isBoolean()) return scope.result.booleanValue() ? QStringLiteral("true") : QStringLiteral("false"); - if (scope.result.isString()) - return quote(scope.result.stringValue()->toQString()); + if (String *s = scope.result.stringValue()) + return quote(s->toQString()); if (scope.result.isNumber()) { double d = scope.result.toNumber(); @@ -940,8 +940,8 @@ ReturnedValue JsonObject::method_stringify(CallContext *ctx) if (s->isNumber()) { stringify.gap = QString(qMin(10, (int)s->toInteger()), ' '); - } else if (s->isString()) { - stringify.gap = s->stringValue()->toQString().left(10); + } else if (String *str = s->stringValue()) { + stringify.gap = str->toQString().left(10); } @@ -982,8 +982,8 @@ QJsonValue JsonObject::toJsonValue(const Value &value, V4ObjectSet &visitedObjec return QJsonValue(QJsonValue::Null); else if (value.isUndefined()) return QJsonValue(QJsonValue::Undefined); - else if (value.isString()) - return QJsonValue(value.toQString()); + else if (String *s = value.stringValue()) + return QJsonValue(s->toQString()); Q_ASSERT(value.isObject()); Scope scope(value.as<Object>()->engine()); |