Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qqmljsstoragegeneralizer.cpp
Go to the documentation of this file.
1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3
5
7
23 InstructionAnnotations annotations, Function *function,
25{
26 m_error = error;
27
28 if (QQmlJSScope::ConstPtr &returnType = function->returnType) {
31 returnType = stored;
32 } else {
33 setError(QStringLiteral("Cannot store the return type %1.")
34 .arg(returnType->internalName(), 0));
36 }
37 }
38
39 const auto transformRegister = [&](QQmlJSRegisterContent &content) {
40 if (const QQmlJSScope::ConstPtr &specific = content.storedType())
42 };
43
44 const auto transformRegisters = [&](VirtualRegisters &registers) {
45 for (auto j = registers.begin(), jEnd = registers.end(); j != jEnd; ++j) {
46 QQmlJSRegisterContent &content = j.value().content;
47 transformRegister(content);
48 }
49 };
50
51 for (QQmlJSRegisterContent &argument : function->argumentTypes) {
52 Q_ASSERT(argument.isValid());
53 transformRegister(argument);
54 }
55
56 for (auto i = annotations.begin(), iEnd = annotations.end(); i != iEnd; ++i) {
57 transformRegister(i->second.changedRegister);
58 transformRegisters(i->second.typeConversions);
59 }
60
61 return annotations;
62}
63
iterator begin()
Definition qflatmap_p.h:769
iterator end()
Definition qflatmap_p.h:773
QFlatMap< int, InstructionAnnotation > InstructionAnnotations
const QQmlJSTypeResolver * m_typeResolver
QQmlJS::DiagnosticMessage * m_error
void setError(const QString &message, int instructionOffset)
InstructionAnnotations run(InstructionAnnotations annotations, Function *function, QQmlJS::DiagnosticMessage *error)
QQmlJSScope::ConstPtr genericType(const QQmlJSScope::ConstPtr &type, ComponentIsGeneric allowComponent=ComponentIsGeneric::No) const
void generalizeType(const QQmlJSScope::ConstPtr &type) const
Combined button and popup list for selecting options.
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction function
DBusConnection const char DBusError * error
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
SSL_CTX int(*) void arg)
#define QStringLiteral(str)
QDBusArgument argument