QQmlJSImporter: Do not add QML names as C++ names

Composite types need to be in the cppNames hash so that we don't lose
them. However, we should hide them behind the "anonymous" prefix.

Change-Id: Iaa0588233370631e6fde39dc61d5b8d31c963619
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
This commit is contained in:
Ulf Hermann 2021-09-21 11:26:18 +02:00
parent 02cd8712d8
commit fac27251a6
1 changed files with 4 additions and 1 deletions

View File

@ -224,7 +224,10 @@ void QQmlJSImporter::processImport(const QQmlJSImporter::Import &import,
// add objects
for (auto it = import.objects.begin(); it != import.objects.end(); ++it) {
const auto &val = it.value();
types->cppNames.insert(val->internalName(), val);
const QString name = val->isComposite()
? prefixedName(anonPrefix, val->internalName())
: val->internalName();
types->cppNames.insert(name, val);
const auto exports = val->exports();
if (exports.isEmpty()) {