diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2022-05-05 11:23:03 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2022-05-11 12:56:21 +0200 |
commit | 8d03b13a59a5e3866c982eb14ca2dc57b687d218 (patch) | |
tree | 0a93eae7d9f55e77bcf4702c469e068f618e259b /tools | |
parent | 745cce4391a8b6255605cb304d8bc14b11168423 (diff) |
QML: Port QV4::CompiledData::Alias to new special integer bitfield
Pick-to: 5.15 6.2 6.3
Task-number: QTBUG-99545
Change-Id: I554f9f903a39a83eaf601fd4fd932f685bf343d0
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qmltc/prototype/qml2cppdefaultpasses.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/tools/qmltc/prototype/qml2cppdefaultpasses.cpp b/tools/qmltc/prototype/qml2cppdefaultpasses.cpp index ff7b8b12e8..48b97d3ded 100644 --- a/tools/qmltc/prototype/qml2cppdefaultpasses.cpp +++ b/tools/qmltc/prototype/qml2cppdefaultpasses.cpp @@ -147,12 +147,24 @@ static bool isReservedWord(QStringView word) return std::binary_search(std::begin(cppKeywords), std::end(cppKeywords), word); } +template<typename IRElement> +quint32 irNameIndex(const IRElement &irElement) +{ + return irElement.nameIndex; +} + +template<> +quint32 irNameIndex<QmlIR::Alias>(const QmlIR::Alias &alias) +{ + return alias.nameIndex(); +} + template<typename InputIterator> static decltype(auto) findIrElement(const QmlIR::Document *doc, InputIterator first, InputIterator last, QStringView name) { auto it = std::find_if(first, last, [&](const auto &candidate) { - return name == doc->stringAt(candidate.nameIndex); + return name == doc->stringAt(irNameIndex(candidate)); }); Q_ASSERT(it != last); // must be satisfied by the caller return *it; |