17#include <private/qtqmlcompilerexports_p.h>
24#include <QtCore/qstack.h>
25#include <QtCore/qstring.h>
26#include <QtCore/qstringview.h>
27#include <QtCore/qstringbuilder.h>
28#include <private/qduplicatetracker_p.h>
43template<
typename To,
typename From,
typename std::enable_if_t<!std::is_po
inter_v<To>,
int> = 0>
46 static_assert(!std::is_pointer_v<From>,
"From has to be a smart pointer holding QQmlJSScope");
57template<
typename To,
typename From,
typename std::enable_if_t<std::is_po
inter_v<To>,
int> = 0>
60 static_assert(!std::is_pointer_v<From>,
"From has to be a smart pointer holding QQmlJSScope");
76 return s.replace(u
'\\', u
"\\\\"_s).replace(u
'"', u
"\\\""_s).replace(u
'\n', u
"\\n"_s);
88 return ctor % u
"(\"" % escapeString(
s) % u
"\")";
97 if (!
type.endsWith(u
'*'))
109 for (
int i = 0;
i <
signal.size(); ++
i) {
122 static std::optional<QQmlJSMetaProperty>
127 constexpr int length = int(
sizeof(
"Changed") /
sizeof(
char)) - 1;
131 const bool canNotify = !
p.notify().isEmpty();
132 if (
p.isValid() && (isBindable || canNotify))
161 if (
p.bindable().isEmpty())
164 case PropertyAccessor::PropertyAccessor_Read:
166 case PropertyAccessor::PropertyAccessor_Write:
191 processResolvedProperty =
197 const AliasResolutionVisitor &visitor);
201 const AliasResolutionVisitor &visitor);
203 template<
typename QQmlJSScopePtr,
typename Action>
213 using T =
decltype(getQQmlJSScopeFromSmartPtr<QQmlJSScopePtr>(
214 std::declval<QQmlJSScope::ConstPtr>()));
217 if constexpr (std::is_invocable<Action,
decltype(scope),
219 return check(scope,
mode);
221 static_assert(std::is_invocable<Action,
decltype(scope)>
::value,
222 "Inferred type Action has unexpected arguments");
228 const bool isValueOrSequenceType = [
type]() {
229 switch (
type->accessSemantics()) {
230 case QQmlJSScope::AccessSemantics::Value:
231 case QQmlJSScope::AccessSemantics::Sequence:
240 for (T scope =
type; scope && !seen.
hasSeen(scope);
241 scope = getQQmlJSScopeFromSmartPtr<QQmlJSScopePtr>(scope->baseType())) {
247 const bool isQObject = scope->internalName() ==
QLatin1String(
"QObject");
248 auto [extensionPtr, extensionKind] = scope->extensionType();
249 auto extension = getQQmlJSScopeFromSmartPtr<QQmlJSScopePtr>(extensionPtr);
254 if (checkWrapper(
extension, extensionKind))
257 }
while (isValueOrSequenceType || isQObject);
266 template<
typename Action>
283 std::reverse(children.begin(), children.end());
284 stack.
append(std::move(children));
298 template<
typename Action>
326 "ObjectPrototype"_L1,
337 for (
const auto &
name : ignoredExtensionNames) {
344 searchBaseAndExtensionTypes(scope, collect);
347 all.reserve(extensions.
size() +
types.size());
349 all.append(std::move(extensions));
350 all.append(std::move(
types));
352 auto begin = all.cbegin();
362 static std::optional<QQmlJSFixSuggestion> didYouMean(
const QString &userInput,
366 static std::variant<QString, QQmlJS::DiagnosticMessage>
qsizetype size() const noexcept
bool isEmpty() const noexcept
void append(parameter_type t)
QVector< QQmlJSScope::Ptr > childScopes()
bool isArrayScope() const
QQmlJSMetaProperty property(const QString &name) const
QQmlJSScope::ConstPtr baseType() const
T pop()
Removes the top item from the stack and returns it.
void push(const T &t)
Adds element t to the top of the stack.
bool startsWith(QStringView s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
constexpr void chop(qsizetype n) noexcept
Truncates this string view by length characters.
constexpr qsizetype size() const noexcept
Returns the size of this string view, in UTF-16 code units (that is, surrogate pairs count as two for...
bool endsWith(QStringView s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
QString toString() const
Returns a deep copy of this string view's data as a QString.
constexpr QStringView mid(qsizetype pos, qsizetype n=-1) const noexcept
Returns the substring of length length starting at position start in this object.
\macro QT_RESTRICTED_CAST_FROM_ASCII
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Combined button and popup list for selecting options.
static auto getQQmlJSScopeFromSmartPtr(const From &p) -> From
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 return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLsizei GLenum GLenum * types
GLenum GLuint GLenum GLsizei length
static QQmlJSUtils::ResolvedAlias resolveAlias(ScopeForId scopeForId, const QQmlJSMetaProperty &property, const QQmlJSScope::ConstPtr &owner, const QQmlJSUtils::AliasResolutionVisitor &visitor)
bool Q_QMLCOMPILER_PRIVATE_EXPORT canCompareWithQUrl(const QQmlJSTypeResolver *typeResolver, const QQmlJSRegisterContent &lhsContent, const QQmlJSRegisterContent &rhsContent)
bool Q_QMLCOMPILER_PRIVATE_EXPORT canCompareWithQObject(const QQmlJSTypeResolver *typeResolver, const QQmlJSRegisterContent &lhsContent, const QQmlJSRegisterContent &rhsContent)
bool Q_QMLCOMPILER_PRIVATE_EXPORT canStrictlyCompareWithVar(const QQmlJSTypeResolver *typeResolver, const QQmlJSRegisterContent &lhsContent, const QQmlJSRegisterContent &rhsContent)
QtPrivate::QRegularExpressionMatchIteratorRangeBasedForIterator begin(const QRegularExpressionMatchIterator &iterator)
QLatin1StringView QLatin1String
QQmlJSScope::ConstPtr owner
QQmlJSMetaProperty property
static QString escapeString(QString s)
static void traverseFollowingQmlIrObjectStructure(const QQmlJSScope::Ptr &root, Action act)
static QString toLiteral(const QString &s, QStringView ctor=u"QStringLiteral")
static std::optional< QQmlJSMetaProperty > changeHandlerProperty(const QQmlJSScope::ConstPtr &scope, QStringView signalName)
static bool hasCompositeBase(const QQmlJSScope::ConstPtr &scope)
static void traverseFollowingMetaObjectHierarchy(const QQmlJSScope::ConstPtr &scope, const QQmlJSScope::ConstPtr &start, Action act)
static QString constRefify(QString type)
static std::optional< QString > signalName(QStringView handlerName)
static bool bindablePropertyHasDefaultAccessor(const QQmlJSMetaProperty &p, PropertyAccessor accessor)
static bool searchBaseAndExtensionTypes(QQmlJSScopePtr type, const Action &check)