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-17 11:15:28 +0200 |
commit | c4c06953a7382033aee55ee1db2bdeb43d6532c8 (patch) | |
tree | fb81d6ba9f5530b0492492b9587658b38400fae1 /tools/qmltc | |
parent | c13d4f62b4eaef8b80cce4ce488d70c3afd43077 (diff) |
QML: Port QV4::CompiledData::Alias to new special integer bitfield
Task-number: QTBUG-99545
Change-Id: I554f9f903a39a83eaf601fd4fd932f685bf343d0
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
(cherry picked from commit 8d03b13a59a5e3866c982eb14ca2dc57b687d218)
Diffstat (limited to 'tools/qmltc')
-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 8eda649441..f037402295 100644 --- a/tools/qmltc/prototype/qml2cppdefaultpasses.cpp +++ b/tools/qmltc/prototype/qml2cppdefaultpasses.cpp @@ -143,12 +143,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; |