diff options
Diffstat (limited to 'src/qml/jsruntime/qv4propertykey.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4propertykey.cpp | 55 |
1 files changed, 11 insertions, 44 deletions
diff --git a/src/qml/jsruntime/qv4propertykey.cpp b/src/qml/jsruntime/qv4propertykey.cpp index 064d030b83..65dd7e7fc1 100644 --- a/src/qml/jsruntime/qv4propertykey.cpp +++ b/src/qml/jsruntime/qv4propertykey.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qv4propertykey_p.h" @@ -43,12 +7,15 @@ #include <qv4string_p.h> #include <qv4engine_p.h> #include <qv4scopedvalue_p.h> +#include <private/qv4mm_p.h> + +using namespace Qt::Literals::StringLiterals; QV4::Heap::StringOrSymbol *QV4::PropertyKey::toStringOrSymbol(QV4::ExecutionEngine *e) { if (isArrayIndex()) return Value::fromUInt32(asArrayIndex()).toString(e); - return static_cast<Heap::StringOrSymbol *>(asStringOrSymbol()); + return asStringOrSymbol(); } bool QV4::PropertyKey::isString() const { @@ -57,7 +24,7 @@ bool QV4::PropertyKey::isString() const { } bool QV4::PropertyKey::isSymbol() const { - Heap::Base *s = asStringOrSymbol(); + Heap::StringOrSymbol *s = asStringOrSymbol(); return s && !s->internalClass->vtable->isString && s->internalClass->vtable->isStringOrSymbol; } @@ -92,9 +59,9 @@ QV4::Heap::String *QV4::PropertyKey::asFunctionName(ExecutionEngine *engine, Fun { QString n; if (prefix == Getter) - n = QStringLiteral("get "); + n += "get "_L1; else if (prefix == Setter) - n = QStringLiteral("set "); + n += "set "_L1; if (isArrayIndex()) n += QString::number(asArrayIndex()); else { @@ -102,8 +69,8 @@ QV4::Heap::String *QV4::PropertyKey::asFunctionName(ExecutionEngine *engine, Fun QString str = s->toQString(); if (s->internalClass->vtable->isString) n += s->toQString(); - else if (str.length() > 1) - n += QChar::fromLatin1('[') + str.midRef(1) + QChar::fromLatin1(']'); + else if (str.size() > 1) + n += QChar::fromLatin1('[') + QStringView{str}.mid(1) + QChar::fromLatin1(']'); } return engine->newString(n); } |