17#include <qtqmlcompilerexports.h>
24#include <QtCore/qdir.h>
25#include <QtCore/qstack.h>
26#include <QtCore/qstring.h>
27#include <QtCore/qstringbuilder.h>
28#include <QtCore/qstringview.h>
30#include <QtQml/private/qqmlsignalnames_p.h>
31#include <private/qduplicatetracker_p.h>
46template<
typename To,
typename From,
typename std::enable_if_t<!std::is_po
inter_v<To>,
int> = 0>
49 static_assert(!std::is_pointer_v<From>,
"From has to be a smart pointer holding QQmlJSScope");
60template<
typename To,
typename From,
typename std::enable_if_t<std::is_po
inter_v<To>,
int> = 0>
63 static_assert(!std::is_pointer_v<From>,
"From has to be a smart pointer holding QQmlJSScope");
79 return s.replace(
'\\'_L1,
"\\\\"_L1)
80 .replace(
'"'_L1,
"\\\""_L1)
81 .replace(
'\n'_L1,
"\\n"_L1)
82 .replace(
'?'_L1,
"\\?"_L1);
94 return ctor % u
"(\"" % escapeString(
s) % u
"\")";
103 if (!
type.endsWith(u
'*'))
108 static std::optional<QQmlJSMetaProperty>
113 constexpr int length = int(
sizeof(
"Changed") /
sizeof(
char)) - 1;
115 auto p = scope->
property(signalName.toString());
117 const bool canNotify = !
p.notify().isEmpty();
118 if (
p.isValid() && (isBindable || canNotify))
123 static std::optional<QQmlJSMetaProperty>
132 const bool canNotify = !
p.notify().isEmpty();
133 if (
p.isValid() && (isBindable || canNotify))
162 if (
p.bindable().isEmpty())
165 case PropertyAccessor::PropertyAccessor_Read:
167 case PropertyAccessor::PropertyAccessor_Write:
192 processResolvedProperty =
198 const AliasResolutionVisitor &visitor);
202 const AliasResolutionVisitor &visitor);
204 template<
typename QQmlJSScopePtr,
typename Action>
214 using T =
decltype(getQQmlJSScopeFromSmartPtr<QQmlJSScopePtr>(
215 std::declval<QQmlJSScope::ConstPtr>()));
218 if constexpr (std::is_invocable<Action,
decltype(scope),
220 return check(scope,
mode);
222 static_assert(std::is_invocable<Action,
decltype(scope)>
::value,
223 "Inferred type Action has unexpected arguments");
229 const bool isValueOrSequenceType = [
type]() {
230 switch (
type->accessSemantics()) {
231 case QQmlJSScope::AccessSemantics::Value:
232 case QQmlJSScope::AccessSemantics::Sequence:
240 QDuplicateTracker<T> seen;
241 for (T scope =
type; scope && !seen.hasSeen(scope);
242 scope = getQQmlJSScopeFromSmartPtr<QQmlJSScopePtr>(scope->baseType())) {
243 QDuplicateTracker<T> seenExtensions;
248 const bool isQObject = scope->internalName() ==
QLatin1String(
"QObject");
249 auto [extensionPtr, extensionKind] = scope->extensionType();
250 auto extension = getQQmlJSScopeFromSmartPtr<QQmlJSScopePtr>(extensionPtr);
255 if (checkWrapper(
extension, extensionKind))
258 }
while (isValueOrSequenceType || isQObject);
267 template<
typename Action>
273 QStack<QQmlJSScope::Ptr> stack;
276 while (!stack.isEmpty()) {
284 std::reverse(children.begin(), children.end());
285 stack.append(std::move(children));
299 template<
typename Action>
327 "ObjectPrototype"_L1,
330 QList<QQmlJSScope::AnnotatedScope>
types;
331 QList<QQmlJSScope::AnnotatedScope> extensions;
338 for (
const auto &
name : ignoredExtensionNames) {
345 searchBaseAndExtensionTypes(scope, collect);
347 QList<QQmlJSScope::AnnotatedScope> all;
348 all.reserve(extensions.size() +
types.size());
350 all.append(std::move(extensions));
351 all.append(std::move(
types));
353 auto begin = all.cbegin();
363 static std::optional<QQmlJSFixSuggestion> didYouMean(
const QString &userInput,
367 static std::variant<QString, QQmlJS::DiagnosticMessage>
370 template <
typename Container>
373 std::sort(container.begin(), container.end());
374 auto erase = std::unique(container.begin(), container.end());
375 container.erase(
erase, container.end());
static QString cleanPath(const QString &path)
Returns path with directory separators normalized (that is, platform-native separators converted to "...
QVector< QQmlJSScope::Ptr > childScopes()
bool isArrayScope() const
QQmlJSMetaProperty property(const QString &name) const
QQmlJSScope::ConstPtr baseType() const
static std::optional< QString > changedHandlerNameToPropertyName(QStringView handler)
\macro QT_RESTRICTED_CAST_FROM_ASCII
bool isEmpty() const noexcept
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
qsizetype erase(QByteArray &ba, const T &t)
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
GLsizei const GLuint * paths
GLsizei const GLchar *const * path
static QQmlJSUtils::ResolvedAlias resolveAlias(ScopeForId scopeForId, const QQmlJSMetaProperty &property, const QQmlJSScope::ConstPtr &owner, const QQmlJSUtils::AliasResolutionVisitor &visitor)
bool Q_QMLCOMPILER_EXPORT canCompareWithQObject(const QQmlJSTypeResolver *typeResolver, const QQmlJSScope::ConstPtr &lhsType, const QQmlJSScope::ConstPtr &rhsType)
bool Q_QMLCOMPILER_EXPORT canCompareWithQUrl(const QQmlJSTypeResolver *typeResolver, const QQmlJSScope::ConstPtr &lhsType, const QQmlJSScope::ConstPtr &rhsType)
bool Q_QMLCOMPILER_EXPORT canStrictlyCompareWithVar(const QQmlJSTypeResolver *typeResolver, const QQmlJSScope::ConstPtr &lhsType, const QQmlJSScope::ConstPtr &rhsType)
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 > propertyFromChangedHandler(const QQmlJSScope::ConstPtr &scope, QStringView changedHandler)
static QStringList cleanPaths(QStringList &&paths)
static std::optional< QQmlJSMetaProperty > changeHandlerProperty(const QQmlJSScope::ConstPtr &scope, QStringView signalName)
static void deduplicate(Container &container)
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 bool bindablePropertyHasDefaultAccessor(const QQmlJSMetaProperty &p, PropertyAccessor accessor)
static bool searchBaseAndExtensionTypes(QQmlJSScopePtr type, const Action &check)