aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/parser/qqmljsengine_p.cpp
diff options
context:
space:
mode:
authorKarsten Heimrich <karsten.heimrich@qt.io>2020-06-16 10:23:19 +0200
committerKarsten Heimrich <karsten.heimrich@qt.io>2020-06-16 22:46:16 +0200
commit1b10ce6a08edbc2ac7e8fd7e97e3fc691f2081df (patch)
tree34ab485d1dd9435369709b5e77c11af6dec78c22 /src/qml/parser/qqmljsengine_p.cpp
parentb65eee039092fa664e781cdd98a4bb5e66815218 (diff)
Port QtDeclarative from QStringRef to QStringView
Task-number: QTBUG-84319 Change-Id: I2dcfb8a2db98282c7a1acdad1e6f4f949f26df15 Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/qml/parser/qqmljsengine_p.cpp')
-rw-r--r--src/qml/parser/qqmljsengine_p.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/qml/parser/qqmljsengine_p.cpp b/src/qml/parser/qqmljsengine_p.cpp
index cb6b0375e6..53ad8820dd 100644
--- a/src/qml/parser/qqmljsengine_p.cpp
+++ b/src/qml/parser/qqmljsengine_p.cpp
@@ -143,14 +143,13 @@ void Engine::setDirectives(Directives *directives)
MemoryPool *Engine::pool()
{ return &_pool; }
-QStringRef Engine::newStringRef(const QString &text)
+QStringView Engine::newStringRef(const QString &text)
{
- const int pos = _extraCode.length();
- _extraCode += text;
- return _extraCode.midRef(pos, text.length());
+ _extraCode.append(text);
+ return QStringView{_extraCode.last()};
}
-QStringRef Engine::newStringRef(const QChar *chars, int size)
+QStringView Engine::newStringRef(const QChar *chars, int size)
{ return newStringRef(QString(chars, size)); }
} // end of namespace QQmlJS