From 5d35573a62686aa3b0c45fc032b79670d88ebba9 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Thu, 24 Nov 2016 16:05:14 +0100 Subject: 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 --- src/qml/jsruntime/qv4stringobject.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/qml/jsruntime/qv4stringobject.cpp') diff --git a/src/qml/jsruntime/qv4stringobject.cpp b/src/qml/jsruntime/qv4stringobject.cpp index 68b693c5a0..6fbf1c3c85 100644 --- a/src/qml/jsruntime/qv4stringobject.cpp +++ b/src/qml/jsruntime/qv4stringobject.cpp @@ -218,8 +218,8 @@ static QString getThisString(ExecutionContext *ctx) { Scope scope(ctx); ScopedValue t(scope, ctx->thisObject()); - if (t->isString()) - return t->stringValue()->toQString(); + if (String *s = t->stringValue()) + return s->toQString(); if (StringObject *thisString = t->as()) return thisString->d()->string->toQString(); if (t->isUndefined() || t->isNull()) { @@ -282,13 +282,13 @@ ReturnedValue StringPrototype::method_concat(CallContext *context) if (scope.engine->hasException) return Encode::undefined(); - ScopedValue v(scope); + ScopedString s(scope); for (int i = 0; i < context->argc(); ++i) { - v = context->args()[i].toString(scope.engine); + s = context->args()[i].toString(scope.engine); if (scope.hasException()) return Encode::undefined(); - Q_ASSERT(v->isString()); - value += v->stringValue()->toQString(); + Q_ASSERT(s->isString()); + value += s->toQString(); } return context->d()->engine->newString(value)->asReturnedValue(); -- cgit v1.2.3