11#include <QtCore/qqueue.h> 
   12#include <QtCore/qsharedpointer.h> 
   14#include <private/qduplicatetracker_p.h> 
   46        parent->m_childScopes.removeOne(childScope);
 
   59        parent->m_childScopes.append(cloned);
 
   69        m_jsIdentifiers.insert(
name, identifier);
 
   73            targetScope = targetScope->parentScope();
 
   74        targetScope->m_jsIdentifiers.insert(
name, identifier);
 
   82    method.setMethodType(QQmlJSMetaMethodType::Signal);
 
   83    method.setIsImplicitQmlPropertyChangeSignal(
true);
 
  170        for (
const auto &
e : 
scope->m_enumerations) {
 
  171            if (
e.keys().contains(
name))
 
  211    const auto internal = 
"$internal$."_L1;
 
  212    const QString anonymous = 
"$anonymous$."_L1;
 
  217        pretty = pretty.
mid(internal.size());
 
  219        pretty = pretty.
mid(anonymous.
size());
 
  221    if (pretty == u
"std::nullptr_t")
 
  224    if (pretty == u
"void")
 
  225        return u
"undefined"_s;
 
  246    const bool propertyVerdict = 
property.type()->internalName() == u
"QQmlComponent";
 
  248    const bool assignedTypeVerdict = [&assignedType]() {
 
  259        if (cppBase->internalName() == u
"QQmlComponent")
 
  261        for (; cppBase; cppBase = cppBase->baseType()) {
 
  262            if (cppBase->internalName() == u
"QQmlAbstractDelegateComponent")
 
  268    return propertyVerdict && assignedTypeVerdict;
 
  288    return base->internalName() == u
"QQmlComponent";
 
  297    return qmlScope->m_properties.contains(
id)
 
  298            || qmlScope->m_methods.contains(
id)
 
  299            || qmlScope->m_enumerations.contains(
id);
 
  309            && jsScope->m_jsIdentifiers.contains(
id))
 
  322std::optional<QQmlJSScope::JavaScriptIdentifier>
 
  328            auto it = 
scope->m_jsIdentifiers.find(
id);
 
  329            if (
it != 
scope->m_jsIdentifiers.end())
 
  334    return std::optional<JavaScriptIdentifier>{};
 
  339    auto it = m_jsIdentifiers.find(
id);
 
  340    if (
it != m_jsIdentifiers.end())
 
  343    return std::optional<JavaScriptIdentifier>{};
 
  349    const int separatorIndex = 
typeName.lastIndexOf(u
'.');
 
  351    if (separatorIndex < 1 || separatorIndex >= 
typeName.size() - 1)
 
  354    const auto parentIt = contextualTypes.
types().constFind(
typeName.first(separatorIndex).toString());
 
  355    if (parentIt == contextualTypes.
types().constEnd())
 
  358    auto inlineComponentParent = *parentIt;
 
  366    candidatesForInlineComponents.
enqueue(inlineComponentParent.scope);
 
  367    while (candidatesForInlineComponents.
size()) {
 
  372            return { current, inlineComponentParent.revision };
 
  387    const auto useType = [&]() {
 
  388        if (usedTypes != 
nullptr)
 
  394    if (
type != contextualTypes.
types().constEnd()) {
 
  399    const auto findListType = [&](
const QString &prefix, 
const QString &postfix)
 
  401        if (
name.startsWith(prefix) && 
name.endsWith(postfix)) {
 
  404                    = 
name.
mid(prefixLength, 
name.length() - prefixLength - postfix.length());
 
  406                    = 
findType(elementName, contextualTypes, usedTypes);
 
  416    switch (contextualTypes.
context()) {
 
  418        if (
const auto listType = findListType(u
"QList<"_s, u
">"_s);
 
  423        if (
const auto listType = findListType(u
"QQmlListProperty<"_s, u
">"_s);
 
  430        if (colonColon == -1)
 
  434        const auto outerType = contextualTypes.
types().constFind(outerTypeName);
 
  435        if (outerType == contextualTypes.
types().constEnd())
 
  438        for (
const auto &innerType : std::as_const(outerType->scope->m_childScopes)) {
 
  439            if (innerType->m_internalName == 
name) {
 
  441                return { innerType, outerType->revision };
 
  450        if (inlineComponent.scope) {
 
  452            return inlineComponent;
 
  468    if (self->accessSemantics() == AccessSemantics::Sequence
 
  469            && self->internalName().
startsWith(u
"QQmlListProperty<"_s)) {
 
  470        self->setIsListProperty(
true);
 
  484    if (!
self->m_extensionType) {
 
  486            if (
self->accessSemantics() == AccessSemantics::Sequence) {
 
  488                self->setExtensionTypeName(u
"Array"_s);
 
  503            it->setType(
it->isList() ? 
type.scope->listType() : 
type.scope);
 
  509            it->setType(
it->isList()
 
  516        const QString returnTypeName = 
it->returnTypeName();
 
  517        if (!
it->returnType() && !returnTypeName.
isEmpty()) {
 
  519            it->setReturnType(returnType.scope);
 
  522        auto parameters = 
it->parameters();
 
  524            auto ¶meter = parameters[
i];
 
  526                !parameter.type() && !
typeName.isEmpty()) {
 
  528                if (
type.scope && parameter.isList()) {
 
  529                    type.scope = 
type.scope->listType();
 
  530                    parameter.setIsList(
false);
 
  531                    parameter.setIsPointer(
false);
 
  532                    parameter.setTypeName(
type.scope ? 
type.scope->internalName() : 
QString());
 
  533                } 
else if (
type.scope && 
type.scope->isReferenceType()) {
 
  534                    parameter.setIsPointer(
true);
 
  536                parameter.setType({ 
type.scope });
 
  540        it->setParameters(parameters);
 
  551void QQmlJSScope::updateChildScope(
 
  559                    if (mode == QQmlJSScope::ExtensionNamespace)
 
  561                    const auto propertyIt = type->m_properties.find(childScope->internalName());
 
  562                    if (propertyIt != type->m_properties.end()) {
 
  563                        childScope->m_baseType.scope = QQmlJSScope::ConstPtr(propertyIt->type());
 
  564                        if (propertyIt->type())
 
  565                            childScope->m_semantics = propertyIt->type()->accessSemantics();
 
  566                        childScope->setBaseTypeName(propertyIt->typeName());
 
  573        if (
const auto attachedBase = 
findType(
 
  574                    childScope->
internalName(), contextualTypes, usedTypes).scope) {
 
  575            childScope->m_baseType.scope = attachedBase->attachedType();
 
  584template<
typename Resolver, 
typename ChildScopeUpdater>
 
  589    const QTypeRevision revision = resolve(self, contextualTypes, usedTypes);
 
  591    const auto childScopes = self->childScopes();
 
  593        const auto childScope = *
it;
 
  594        update(childScope, self, contextualTypes, usedTypes);
 
  609        return resolveType(self, contextualTypes, usedTypes);
 
  625    if (underlyingType == u
"uint" 
  626        || underlyingType == u
"quint8" 
  627        || underlyingType == u
"ushort" 
  628        || underlyingType == u
"ulonglong") {
 
  632    if (underlyingType == u
"int" 
  633        || underlyingType == u
"qint8" 
  634        || underlyingType == u
"short" 
  635        || underlyingType == u
"longlong") {
 
  661    for (
auto it = self->m_enumerations.
begin(), 
end = self->m_enumerations.
end(); 
it != 
end; ++
it) {
 
  671        else if (
it->isFlag())
 
  675        enumScope->m_baseType = { 
type.scope, 
type.revision };
 
  677        enumScope->m_semantics = AccessSemantics::Value;
 
  678        enumScope->m_internalName = self->internalName() + 
QStringLiteral(
"::") + 
it->name();
 
  679        if (
QString alias = 
it->alias(); !alias.isEmpty()
 
  680            && self->m_enumerations.constFind(alias) == self->m_enumerations.
constEnd()) {
 
  682            aliasScope->m_internalName = self->internalName() + 
QStringLiteral(
"::") + alias;
 
  685            toBeAppended.
insert(alias, cpy);
 
  690    self->m_enumerations.
insert(toBeAppended);
 
  695    if (self->listType() || self->accessSemantics() == AccessSemantics::Sequence)
 
  703    if (self->isComposite()) {
 
  707    } 
else if (self->isReferenceType()) {
 
  743    auto qmlScope = 
scope;
 
  808                    owner = { scope, mode };
 
  819        m_requiredPropertyNames.removeOne(
name);
 
  820    else if (!m_requiredPropertyNames.contains(
name))
 
  821        m_requiredPropertyNames.append(
name);
 
  826    bool isRequired = 
false;
 
  849    return m_requiredPropertyNames.contains(
name);
 
  853              "We really want T to be relocatable as it improves QList<T> performance");
 
  856                                                    BindingTargetSpecifier specifier)
 
  867        m_propertyBindingsArray.emplaceFront(binding.
propertyName(),
 
  872        const auto bindingOnTheSameProperty =
 
  880        auto pos = std::find_if_not(m_propertyBindingsArray.begin(), m_propertyBindingsArray.end(),
 
  881                                    bindingOnTheSameProperty);
 
  892            for (
auto it = m_propertyBindingsArray.cbegin(); 
it != m_propertyBindingsArray.cend();
 
  894                if (!(
it->sourceLocationOffset <= 
x.sourceLocation().offset))
 
  904                m_propertyBindingsArray.emplaceFront(
x.propertyName(), 
x.sourceLocation().offset);
 
  905            } 
else if (
pos == m_propertyBindingsArray.size()) {
 
  906                m_propertyBindingsArray.emplaceBack(
x.propertyName(), 
x.sourceLocation().offset);
 
  909                m_propertyBindingsArray.emplace(
pos + 1, 
x.propertyName(),
 
  910                                                x.sourceLocation().offset);
 
  914        const qsizetype insertionPos = findInsertionPoint(binding);
 
  915        insertAfter(insertionPos, binding);
 
  928    qmlIrOrdered.
reserve(m_propertyBindingsArray.size());
 
  930    for (
const auto &
data : m_propertyBindingsArray) {
 
  934            return x.sourceLocation().
offset == 
data.sourceLocationOffset;
 
  937        qmlIrOrdered.
append(*binding);
 
  978                return scope->m_interfaceNames.contains(
name);
 
  984    bool isDeferred = 
false;
 
  988        if (!immediate.isEmpty()) {
 
  989            isDeferred = !immediate.contains(name);
 
  993        if (!deferred.isEmpty()) {
 
  994            isDeferred = deferred.contains(
name);
 
 1011    if (firstRevision != lastRevision) {
 
 1075    const bool nameIsEmpty = (m_scopeType == ScopeType::AttachedPropertyScope
 
 1076                              || m_scopeType == ScopeType::GroupedPropertyScope)
 
 1078            : m_baseTypeNameOrError.
isEmpty();
 
 1081    if (m_baseType.scope.isNull())
 
 1110    bool baseResolved = 
true;
 
 1113            baseResolved = false;
 
 1119    return baseResolved;
 
 1123                            bool isDependency) :
 
 1124    m_prefix(
std::move(prefix)),
 
 1128    m_isDependency(isDependency)
 
 1134    return !m_name.isEmpty();
 
 1139    : m_package(
std::move(package))
 
 1141    , m_version(
std::move(version))
 
 1142    , m_revision(
std::move(revision))
 
 1148    return m_version.isValid() || !m_package.isEmpty() || !m_type.isEmpty();
 
 1157    m_importer->m_globalWarnings.append(typeReader.errors());
 
 1163        m_importer->m_globalWarnings.append(
 
 1165                          "Type %1 declared as singleton in qmldir but missing pragma Singleton")
 
 1170        m_importer->m_globalWarnings.append(
 
 1172                                 "but using pragma Singleton")
 
 1190    const bool isBaseComponent = [
this]() {
 
 1197            if (cppBase->internalName() == u
"QQmlAbstractDelegateComponent")
 
 1236    return m_inlineComponentName;
 
 1247        if (
type->isInlineComponent())
 
 1248            return *
type->inlineComponentName();
 
 1278            return isCreatableNonRecursive(
scope);
 
 1281            if (isCreatableNonRecursive(
scope))
 
QSharedPointer< T > toStrongRef() const
const_iterator constEnd() const noexcept
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary item after the ...
iterator find(const Key &key)
Returns an iterator pointing to the item with the key in the hash.
const_iterator constBegin() const noexcept
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first item in the hash.
bool contains(const Key &key) const noexcept
Returns true if the hash contains an item with the key; otherwise returns false.
iterator end() noexcept
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the imaginary item after the last ...
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
qsizetype size() const noexcept
iterator insert(qsizetype i, parameter_type t)
void reserve(qsizetype size)
void append(parameter_type t)
const_iterator constBegin() const noexcept
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first item in the hash.
const_iterator constEnd() const noexcept
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary item after the ...
QPair< iterator, iterator > equal_range(const Key &key)
bool contains(const Key &key) const noexcept
Tracks the types for the QmlCompiler.
QHash< QString, QQmlJSMetaProperty > properties() const
Returns all properties visible from this scope including those of base types and extensions.
QString attachedTypeName() const
QList< QQmlJSMetaPropertyBinding > propertyBindings(const QString &name) const
static void resolveGeneralizedGroup(const QQmlJSScope::Ptr &self, const QQmlJSScope::ConstPtr &baseType, const QQmlJSScope::ContextualTypes &contextualTypes, QSet< QString > *usedTypes=nullptr)
bool isStructured() const
bool hasOwnPropertyBindings(const QString &name) const
void insertJSIdentifier(const QString &name, const JavaScriptIdentifier &identifier)
QDeferredSharedPointer< QQmlJSScope > Ptr
bool isNameDeferred(const QString &name) const
QHash< QString, QQmlJSMetaMethod > methods() const
Returns all methods visible from this scope including those of base types and extensions.
InlineComponentOrDocumentRootName enclosingInlineComponentName() const
QString defaultPropertyName() const
bool isInCustomParserParent() const
bool hasPropertyBindings(const QString &name) const
static QQmlJSScope::Ptr create()
bool isSameType(const QQmlJSScope::ConstPtr &otherScope) const
void setAccessSemantics(AccessSemantics semantics)
void setModuleName(const QString &moduleName)
std::monostate RootDocumentNameType
static AnnotatedScope ownerOfProperty(const QQmlJSScope::ConstPtr &self, const QString &name)
bool isComponentRootElement() const
bool isIdInjectedFromSignal(const QString &id) const
QQmlJSScope::Ptr parentScope()
ScopeType scopeType() const
bool hasStructuredFlag() const
void setInternalName(const QString &internalName)
QString baseTypeName() const
QString internalName() const
bool hasCreatableFlag() const
static void resolveEnums(const QQmlJSScope::Ptr &self, const QQmlJSScope::ContextualTypes &contextualTypes, QSet< QString > *usedTypes=nullptr)
static bool causesImplicitComponentWrapping(const QQmlJSMetaProperty &property, const QQmlJSScope::ConstPtr &assignedType)
Returns if assigning assignedType to property would require an implicit component wrapping.
void setIsSingleton(bool v)
bool isReferenceType() const
static QQmlJSScope::ConstPtr nonCompositeBaseType(const QQmlJSScope::ConstPtr &type)
void addOwnProperty(const QQmlJSMetaProperty &prop)
QString parentPropertyName() const
static void resolveList(const QQmlJSScope::Ptr &self, const QQmlJSScope::ConstPtr &arrayType)
QHash< QString, QQmlJSMetaEnum > enumerations() const
@ WrappedInImplicitComponent
bool isIdInCurrentScope(const QString &id) const
QString moduleName() const
bool isInlineComponent() const
void insertPropertyIdentifier(const QQmlJSMetaProperty &prop)
AccessSemantics accessSemantics() const
static QQmlSA::Element createQQmlSAElement(const ConstPtr &)
bool hasEnumeration(const QString &name) const
static QTypeRevision resolveTypes(const Ptr &self, const QQmlJSScope::ContextualTypes &contextualTypes, QSet< QString > *usedTypes=nullptr)
QVector< QQmlJSScope::Ptr > childScopes()
bool hasEnumerationKey(const QString &name) const
static QString qualifiedNameFrom(const QString &moduleName, const QString &typeName, const QTypeRevision &firstRevision, const QTypeRevision &lastRevision)
void setBaseTypeName(const QString &baseTypeName)
QString ownDefaultPropertyName() const
bool hasCustomParser() const
QString qualifiedName() const
bool isListProperty() const
QStringList ownDeferredNames() const
bool isFullyResolved() const
void setQualifiedName(const QString &qualifiedName)
bool hasInterface(const QString &name) const
QQmlJSMetaEnum enumeration(const QString &name) const
QList< QQmlJSMetaPropertyBinding > ownPropertyBindingsInQmlIROrder() const
QQmlJSScope(const QString &internalName)
bool hasMethod(const QString &name) const
QQmlJSScope::ConstPtr listType() const
static const QQmlJSScope::ConstPtr & scope(const QQmlSA::Element &)
bool isPropertyRequired(const QString &name) const
QStringList ownImmediateNames() const
void setValueTypeName(const QString &name)
QQmlJSScope::ConstPtr attachedType() const
static QQmlJSScope::Ptr clone(const QQmlJSScope::ConstPtr &origin)
QDeferredSharedPointer< const QQmlJSScope > ConstPtr
std::optional< JavaScriptIdentifier > findJSIdentifier(const QString &id) const
std::variant< InlineComponentNameType, RootDocumentNameType > InlineComponentOrDocumentRootName
A Hashable type to differentiate document roots from different inline components.
QQmlJSMetaProperty property(const QString &name) const
std::optional< JavaScriptIdentifier > JSIdentifier(const QString &id) const
static QString prettyName(QAnyStringView name)
bool hasOwnProperty(const QString &name) const
static ImportedScope< QQmlJSScope::ConstPtr > findType(const QString &name, const ContextualTypes &contextualTypes, QSet< QString > *usedTypes=nullptr)
bool canAssign(const QQmlJSScope::ConstPtr &derived) const
bool isIdInCurrentQmlScopes(const QString &id) const
QQmlJSScope::ConstPtr baseType() const
void addOwnMethod(const QQmlJSMetaMethod &method)
bool isPropertyLocallyRequired(const QString &name) const
QString ownParentPropertyName() const
std::optional< QString > inlineComponentName() const
bool hasProperty(const QString &name) const
QQmlJSScope::ConstPtr ownAttachedType() const
static void reparent(const QQmlJSScope::Ptr &parentScope, const QQmlJSScope::Ptr &childScope)
static QQmlJSScope::ConstPtr findCurrentQMLScope(const QQmlJSScope::ConstPtr &scope)
QMultiHash< QString, QQmlJSMetaPropertyBinding > ownPropertyBindings() const
QString baseTypeError() const
bool isIdInCurrentJSScopes(const QString &id) const
void setFilePath(const QString &file)
QMultiHash< QString, QQmlJSMetaMethod > ownMethods() const
QQmlJSScope::ConstPtr valueType() const
static void resolveNonEnumTypes(const QQmlJSScope::Ptr &self, const QQmlJSScope::ContextualTypes &contextualTypes, QSet< QString > *usedTypes=nullptr)
void setPropertyLocallyRequired(const QString &name, bool isRequired)
void setBaseTypeError(const QString &baseTypeError)
QString ownAttachedTypeName() const
void enqueue(const T &t)
Adds value t to the tail of the queue.
T dequeue()
Removes the head item in the queue and returns it.
iterator insert(const T &value)
\macro QT_RESTRICTED_CAST_FROM_ASCII
iterator begin()
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the first character in the string.
const_iterator constEnd() const
Returns a const \l{STL-style iterators}{STL-style iterator} pointing just after the last character in...
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
qsizetype size() const
Returns the number of characters in this string.
QString arg(qlonglong a, int fieldwidth=0, int base=10, QChar fillChar=u' ') const
QString mid(qsizetype position, qsizetype n=-1) const
Returns a string that contains n characters of this string, starting at the specified position index.
iterator end()
Returns an \l{STL-style iterators}{STL-style iterator} pointing just after the last character in the ...
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
QString & insert(qsizetype i, QChar c)
QChar * data()
Returns a pointer to the data stored in the QString.
QString left(qsizetype n) const
Returns a substring that contains the n leftmost characters of the string.
qsizetype length() const
Returns the number of characters in this string.
constexpr bool hasMinorVersion() const
Returns true if the minor version is known, otherwise false.
constexpr bool hasMajorVersion() const
Returns true if the major version is known, otherwise false.
constexpr quint8 minorVersion() const
Returns the minor version encoded in the revision.
constexpr quint8 majorVersion() const
Returns the major version encoded in the revision.
QSet< QString >::iterator it
Combined button and popup list for selecting options.
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char * method
static QDBusError::ErrorType get(const char *name)
static ControlElement< T > * ptr(QWidget *widget)
GLint GLint GLint GLint GLint x
[0]
GLenum GLuint GLenum GLsizei length
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLuint GLintptr offset
static QString internalName(const QQmlJSScope::ConstPtr &scope)
static QTypeRevision resolveTypesInternal(Resolver resolve, ChildScopeUpdater update, const QQmlJSScope::Ptr &self, const QQmlJSScope::ContextualTypes &contextualTypes, QSet< QString > *usedTypes)
static QQmlJSScope::ImportedScope< QQmlJSScope::ConstPtr > qFindInlineComponents(QStringView typeName, const QQmlJSScope::ContextualTypes &contextualTypes)
static QString flagStorage(const QString &underlyingType)
#define QStringLiteral(str)
if(qFloatDistance(a, b)<(1<< 7))
[0]
bool contains(const AT &t) const noexcept
const QHash< QString, ImportedScope< ConstPtr > > & types() const
ConstPtr arrayType() const
CompileContext context() const
static bool searchBaseAndExtensionTypes(QQmlJSScopePtr type, const Action &check)
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent