Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qqmlsa.h
Go to the documentation of this file.
1// Copyright (C) 2023 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3// Qt-Security score:significant
4
5#ifndef QQMLSA_H
6#define QQMLSA_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is part of the qmllint plugin API, with limited compatibility guarantees.
13// Usage of this API may make your code source and binary incompatible with
14// future versions of Qt.
15//
16
17#include <QtQmlCompiler/qqmlsaconstants.h>
18#include <QtQmlCompiler/qqmljsloggingutils.h>
19
20#include <QtQmlCompiler/qtqmlcompilerexports.h>
21
22#include <QtCore/qhash.h>
23#include <QtCore/qsharedpointer.h>
24#include <QtCore/qplugin.h>
25#include <QtQmlCompiler/qqmlsasourcelocation.h>
26
27#include <unordered_map>
28
29QT_BEGIN_NAMESPACE
30
31namespace QQmlSA {
32
33class BindingPrivate;
34class BindingsPrivate;
36class Element;
37class ElementPass;
38class FixSuggestion;
41class MethodPrivate;
42class MethodsPrivate;
43class PassManager;
44class PassManagerPrivate;
45class PropertyPass;
46class PropertyPrivate;
47struct PropertyPassInfo;
48
51
52class Q_QMLCOMPILER_EXPORT Binding
53{
55
56public:
74
75 Binding();
76 Binding(const Binding &);
77 Binding(Binding &&) noexcept;
78 Binding &operator=(const Binding &);
79 Binding &operator=(Binding &&) noexcept;
81
82 Element groupType() const;
83 Element bindingScope() const;
85 QString stringValue() const;
86 QString propertyName() const;
87 bool isAttached() const;
88 Element attachedType() const;
89
90#if QT_DEPRECATED_SINCE(6, 9)
91 QT_DEPRECATED_X("Use attachedType()")
92 Element attachingType() const;
93#endif
94
96 double numberValue() const;
98 bool hasObject() const;
99 Element objectType() const;
100 bool hasUndefinedScriptValue() const;
101 bool hasFunctionScriptValue() const;
102
103 friend bool operator==(const Binding &lhs, const Binding &rhs)
104 {
105 return operatorEqualsImpl(lhs, rhs);
106 }
107 friend bool operator!=(const Binding &lhs, const Binding &rhs)
108 {
109 return !operatorEqualsImpl(lhs, rhs);
110 }
111
112 static bool isLiteralBinding(BindingType);
113
114private:
115 static bool operatorEqualsImpl(const Binding &, const Binding &);
116
117 std::unique_ptr<BindingPrivate> d_ptr;
118};
119
120class Q_QMLCOMPILER_EXPORT Method
121{
122 Q_DECLARE_PRIVATE(Method)
123
124public:
125 class Q_QMLCOMPILER_EXPORT Methods
126 {
127 Q_DECLARE_PRIVATE(Methods)
128
129 public:
130 Methods();
131 Methods(const Methods &);
132 ~Methods();
133
134 QMultiHash<QString, Method>::const_iterator begin() const { return constBegin(); }
135 QMultiHash<QString, Method>::const_iterator end() const { return constEnd(); }
136 QMultiHash<QString, Method>::const_iterator constBegin() const;
137 QMultiHash<QString, Method>::const_iterator constEnd() const;
138
139 private:
140 std::unique_ptr<MethodsPrivate> d_ptr;
141 };
142
143 Method();
144 Method(const Method &);
145 Method(Method &&) noexcept;
146 Method &operator=(const Method &);
147 Method &operator=(Method &&) noexcept;
148 ~Method();
149
150 QString methodName() const;
152 MethodType methodType() const;
153
154 friend bool operator==(const Method &lhs, const Method &rhs)
155 {
156 return operatorEqualsImpl(lhs, rhs);
157 }
158 friend bool operator!=(const Method &lhs, const Method &rhs)
159 {
160 return !operatorEqualsImpl(lhs, rhs);
161 }
162
163private:
164 static bool operatorEqualsImpl(const Method &, const Method &);
165
166 std::unique_ptr<MethodPrivate> d_ptr;
167};
168
169class Q_QMLCOMPILER_EXPORT Property
170{
171 Q_DECLARE_PRIVATE(Property)
172
173public:
174 Property();
175 Property(const Property &);
176 Property(Property &&) noexcept;
177 Property &operator=(const Property &);
178 Property &operator=(Property &&) noexcept;
179 ~Property();
180
181 QString typeName() const;
182 bool isValid() const;
183 bool isReadonly() const;
184 QQmlSA::Element type() const;
185
186 friend bool operator==(const Property &lhs, const Property &rhs)
187 {
188 return operatorEqualsImpl(lhs, rhs);
189 }
190
191 friend bool operator!=(const Property &lhs, const Property &rhs)
192 {
193 return !operatorEqualsImpl(lhs, rhs);
194 }
195
196private:
197 static bool operatorEqualsImpl(const Property &, const Property &);
198
199 std::unique_ptr<PropertyPrivate> d_ptr;
200};
201
202class Q_QMLCOMPILER_EXPORT Element
203{
204 friend class QT_PREPEND_NAMESPACE(QQmlJSScope);
205
206public:
207 Element();
208 Element(const Element &);
209 Element(Element &&other) noexcept
210 {
211 memcpy(m_data, other.m_data, sizeofElement);
212 memset(other.m_data, 0, sizeofElement);
213 }
214 Element &operator=(const Element &);
215 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(Element)
216 ~Element();
217
218 ScopeType scopeType() const;
219 Element baseType() const;
220 QString baseTypeName() const;
221 Element parentScope() const;
222 bool inherits(const Element &) const;
223 bool isFileRootComponent() const;
224
225 bool isNull() const;
226 QString internalId() const;
227 AccessSemantics accessSemantics() const;
228 bool isComposite() const;
229
230 bool hasProperty(const QString &propertyName) const;
231 bool hasOwnProperty(const QString &propertyName) const;
232 Property property(const QString &propertyName) const;
233 bool isPropertyRequired(const QString &propertyName) const;
234 QString defaultPropertyName() const;
235
236 bool hasMethod(const QString &methodName) const;
237 Method::Methods ownMethods() const;
238
239 QQmlSA::SourceLocation sourceLocation() const;
240 QQmlSA::SourceLocation idSourceLocation() const;
241 QString filePath() const;
242
243 bool hasPropertyBindings(const QString &name) const;
244 bool hasOwnPropertyBindings(const QString &propertyName) const;
245
246 Binding::Bindings ownPropertyBindings() const;
247 Binding::Bindings ownPropertyBindings(const QString &propertyName) const;
248 QList<Binding> propertyBindings(const QString &propertyName) const;
249
250 explicit operator bool() const;
251 bool operator!() const;
252
253 QString name() const;
254
255 friend inline bool operator==(const QQmlSA::Element &lhs, const QQmlSA::Element &rhs)
256 {
257 return operatorEqualsImpl(lhs, rhs);
258 }
259 friend inline bool operator!=(const Element &lhs, const Element &rhs) { return !(lhs == rhs); }
260
261 friend inline qsizetype qHash(const Element &key, qsizetype seed = 0) noexcept
262 {
263 return qHashImpl(key, seed);
264 }
265
266private:
267 static bool operatorEqualsImpl(const Element &, const Element &);
268 static qsizetype qHashImpl(const Element &key, qsizetype seed) noexcept;
269
270 static constexpr qsizetype sizeofElement = 2 * sizeof(QSharedPointer<int>);
271 alignas(QSharedPointer<int>) char m_data[sizeofElement];
272
273 void swap(Element &other) noexcept
274 {
275 char t[sizeofElement];
276 memcpy(t, m_data, sizeofElement);
277 memcpy(m_data, other.m_data, sizeofElement);
278 memcpy(other.m_data, t, sizeofElement);
279 }
280 friend void swap(Element &lhs, Element &rhs) noexcept { lhs.swap(rhs); }
281};
282
283class Q_QMLCOMPILER_EXPORT GenericPass
284{
285 Q_DECLARE_PRIVATE(GenericPass)
286 Q_DISABLE_COPY_MOVE(GenericPass)
287
288public:
289 GenericPass(PassManager *manager);
290 virtual ~GenericPass();
291
292 void emitWarning(QAnyStringView diagnostic, LoggerWarningId id);
293 void emitWarning(QAnyStringView diagnostic, LoggerWarningId id,
294 QQmlSA::SourceLocation srcLocation);
295 void emitWarning(QAnyStringView diagnostic, LoggerWarningId id,
296 QQmlSA::SourceLocation srcLocation, const QQmlSA::FixSuggestion &fix);
297
298 Element resolveTypeInFileScope(QAnyStringView typeName);
299 Element resolveAttachedInFileScope(QAnyStringView typeName);
300 Element resolveType(QAnyStringView moduleName, QAnyStringView typeName); // #### TODO: revisions
301 Element resolveBuiltinType(QAnyStringView typeName) const;
302 Element resolveAttached(QAnyStringView moduleName, QAnyStringView typeName);
303 Element resolveLiteralType(const Binding &binding);
304
305 Element resolveIdToElement(QAnyStringView id, const Element &context);
306 QString resolveElementToId(const Element &element, const Element &context);
307
308 QString sourceCode(QQmlSA::SourceLocation location);
309
310private:
311 std::unique_ptr<GenericPassPrivate> d_ptr;
312};
313
314class Q_QMLCOMPILER_EXPORT PassManager
315{
316 Q_DISABLE_COPY_MOVE(PassManager)
317 Q_DECLARE_PRIVATE(PassManager)
318
319public:
320 void registerElementPass(std::unique_ptr<ElementPass> pass);
321 bool registerPropertyPass(std::shared_ptr<PropertyPass> pass, QAnyStringView moduleName,
322 QAnyStringView typeName,
323 QAnyStringView propertyName = QAnyStringView(),
324 bool allowInheritance = true);
325 void analyze(const Element &root);
326
327 bool hasImportedModule(QAnyStringView name) const;
328
329 bool isCategoryEnabled(LoggerWarningId category) const;
330
332
333private:
334 PassManager();
335 ~PassManager();
336
337 std::unique_ptr<PassManagerPrivate> d_ptr;
338};
339
340class Q_QMLCOMPILER_EXPORT LintPlugin
341{
342public:
343 LintPlugin() = default;
344 virtual ~LintPlugin() = default;
345
346 Q_DISABLE_COPY_MOVE(LintPlugin)
347
348 virtual void registerPasses(PassManager *manager, const Element &rootElement) = 0;
349};
350
351class Q_QMLCOMPILER_EXPORT PropertyPass : public GenericPass
352{
353public:
354 PropertyPass(PassManager *manager);
355
356 virtual void onBinding(const QQmlSA::Element &element, const QString &propertyName,
357 const QQmlSA::Binding &binding, const QQmlSA::Element &bindingScope,
358 const QQmlSA::Element &value);
359 virtual void onRead(const QQmlSA::Element &element, const QString &propertyName,
360 const QQmlSA::Element &readScope, QQmlSA::SourceLocation location);
361 virtual void onCall(const QQmlSA::Element &element, const QString &propertyName,
362 const QQmlSA::Element &readScope, QQmlSA::SourceLocation location);
363 virtual void onWrite(const QQmlSA::Element &element, const QString &propertyName,
364 const QQmlSA::Element &value, const QQmlSA::Element &writeScope,
365 QQmlSA::SourceLocation location);
366};
367
368class Q_QMLCOMPILER_EXPORT ElementPass : public GenericPass
369{
370public:
371 ElementPass(PassManager *manager) : GenericPass(manager) { }
372
373 virtual bool shouldRun(const Element &element);
374 virtual void run(const Element &element) = 0;
375};
376
377class Q_QMLCOMPILER_EXPORT DocumentEdit
378{
379 Q_DECLARE_PRIVATE(DocumentEdit)
380 Q_DECLARE_EQUALITY_COMPARABLE(DocumentEdit)
381
382public:
383 DocumentEdit(const QString &filename, const SourceLocation &location,
384 const QString &replacement);
385 DocumentEdit(const DocumentEdit&);
386 DocumentEdit(DocumentEdit&&);
387 DocumentEdit &operator=(const DocumentEdit&);
388 DocumentEdit &operator=(DocumentEdit &&);
389 ~DocumentEdit();
390
391 QString filename() const;
392 SourceLocation location() const;
393 QString replacement() const;
394
395private:
396 friend bool comparesEqual(const DocumentEdit &self, const DocumentEdit &other) noexcept
397 {
398 return self.filename() == other.filename() && self.location() == other.location()
399 && self.replacement() == other.replacement();
400 }
401
402 std::unique_ptr<DocumentEditPrivate> d_ptr;
403};
404
405class Q_QMLCOMPILER_EXPORT FixSuggestion
406{
407 Q_DECLARE_PRIVATE(FixSuggestion)
408
409public:
410 FixSuggestion(const QString &description, const QQmlSA::SourceLocation &location,
411 const DocumentEdit &documentEdit);
412 FixSuggestion(const QString &description, const QQmlSA::SourceLocation &location,
413 const QList<DocumentEdit> &documentEdits = {});
414 FixSuggestion(const FixSuggestion &);
415 FixSuggestion(FixSuggestion &&) noexcept;
416 FixSuggestion &operator=(const FixSuggestion &);
417 FixSuggestion &operator=(FixSuggestion &&) noexcept;
418 ~FixSuggestion();
419
420 QString description() const;
422
423 void addDocumentEdit(const DocumentEdit &);
425
426 void setFileName(const QString &);
427 QString fileName() const;
428
429 void setAutoApplicable(bool autoApplicable = true);
430 bool isAutoApplicable() const;
431
432 friend bool operator==(const FixSuggestion &lhs, const FixSuggestion &rhs)
433 {
434 return operatorEqualsImpl(lhs, rhs);
435 }
436
437 friend bool operator!=(const FixSuggestion &lhs, const FixSuggestion &rhs)
438 {
439 return !operatorEqualsImpl(lhs, rhs);
440 }
441
442private:
443 static bool operatorEqualsImpl(const FixSuggestion &, const FixSuggestion &);
444
445 std::unique_ptr<FixSuggestionPrivate> d_ptr;
446};
447
448} // namespace QQmlSA
449
450#define QmlLintPluginInterface_iid "org.qt-project.Qt.Qml.SA.LintPlugin/1.0"
451
453
454QT_END_NAMESPACE
455
456#endif // QQMLSA_H
friend bool operator==(const QByteArray::FromBase64Result &lhs, const QByteArray::FromBase64Result &rhs) noexcept
Returns true if lhs and rhs are equal, otherwise returns false.
Definition qbytearray.h:803
friend bool operator!=(const QByteArray::FromBase64Result &lhs, const QByteArray::FromBase64Result &rhs) noexcept
Returns true if lhs and rhs are different, otherwise returns false.
Definition qbytearray.h:814
QString fileName() const
If the currently assigned device is a QFile, or if setFileName() has been called, this function retur...
void setFileName(const QString &fileName)
Sets the file name of QImageReader to fileName.
virtual Type type() const =0
Reimplement this function to return the paint engine \l{Type}.
virtual bool isValid() const
virtual QString location() const
QString typeName() const
void setIsFlag(bool isFlag)
void setLineNumber(int lineNumber)
friend bool operator!=(const QQmlJSMetaEnum &a, const QQmlJSMetaEnum &b)
void setName(const QString &name)
QQmlJSMetaEnum()=default
int lineNumber() const
friend size_t qHash(const QQmlJSMetaEnum &e, size_t seed=0)
friend bool operator==(const QQmlJSMetaEnum &a, const QQmlJSMetaEnum &b)
void setTypeName(const QString &typeName)
bool hasKey(const QString &key) const
void setIsScoped(bool v)
void setType(const QSharedPointer< const QQmlJSScope > &type)
QSharedPointer< const QQmlJSScope > type() const
int value(const QString &key) const
bool isQml() const
void setIsQml(bool v)
void addValue(int value)
bool isScoped() const
QList< int > values() const
bool isFlag() const
QString alias() const
QStringList keys() const
bool isValid() const
void addKey(const QString &key)
void setAlias(const QString &alias)
QString name() const
QQmlJSMetaEnum(QString name)
bool hasValues() const
QQmlJSMetaReturnType returnValue() const
QQmlJSMetaMethod()=default
void setReturnType(QWeakPointer< const QQmlJSScope > type)
void setSourceLocation(QQmlJS::SourceLocation location)
QQmlJS::SourceLocation sourceLocation() const
QString methodName() const
QQmlJSMetaMethodType MethodType
void setMethodName(const QString &name)
void setReturnTypeName(const QString &typeName)
QString returnTypeName() const
QQmlJSMetaMethod(QString name, QString returnType=QString())
QList< QQmlJSMetaParameter > parameters() const
void setReturnValue(const QQmlJSMetaReturnType returnValue)
QSharedPointer< const QQmlJSScope > returnType() const
void setIsPointer(bool isPointer)
void setType(QWeakPointer< const QQmlJSScope > type)
void setIsList(bool isList)
friend bool operator!=(const QQmlJSMetaParameter &a, const QQmlJSMetaParameter &b)
friend size_t qHash(const QQmlJSMetaParameter &e, size_t seed=0)
void setName(const QString &name)
void setTypeName(const QString &typeName)
void setTypeQualifier(Constness typeQualifier)
Constness typeQualifier() const
QString typeName() const
QQmlJSMetaParameter(QString name=QString(), QString typeName=QString(), Constness typeQualifier=NonConst, QWeakPointer< const QQmlJSScope > type={})
friend bool operator==(const QQmlJSMetaParameter &a, const QQmlJSMetaParameter &b)
QSharedPointer< const QQmlJSScope > type() const
\inmodule QtQmlCompiler
friend bool operator!=(const QQmlJSMetaProperty &a, const QQmlJSMetaProperty &b)
QString notify() const
QSharedPointer< const QQmlJSScope > aliasTargetScope() const
QString aliasExpression() const
friend bool operator==(const QQmlJSMetaProperty &a, const QQmlJSMetaProperty &b)
void setIsOverride(bool isOverride)
void setPropertyName(const QString &propertyName)
QString aliasTargetName() const
void setAnnotations(const QList< QQmlJSAnnotation > &annotation)
void setIsList(bool isList)
QString bindable() const
QSharedPointer< const QQmlJSScope > type() const
void setPrivateClass(const QString &privateClass)
void setRead(const QString &read)
friend size_t qHash(const QQmlJSMetaProperty &prop, size_t seed=0)
void setBindable(const QString &bindable)
void setWrite(const QString &write)
void setIsPropertyConstant(bool isPropertyConstant)
QString reset() const
void setRevision(int revision)
void setIsFinal(bool isFinal)
QString typeName() const
void setAliasTargetScope(const QSharedPointer< const QQmlJSScope > &scope)
void setSourceLocation(const QQmlJS::SourceLocation &newSourceLocation)
QString write() const
void setIsTypeConstant(bool isTypeConstant)
const QList< QQmlJSAnnotation > & annotations() const
QQmlJS::SourceLocation sourceLocation() const
void setTypeName(const QString &typeName)
QQmlJSMetaProperty()=default
void setReset(const QString &reset)
QString privateClass() const
void setIsVirtual(bool isVirtual)
void setIsWritable(bool isWritable)
void setAliasExpression(const QString &aliasString)
void setAliasTargetName(const QString &name)
void setIndex(int index)
void setNotify(const QString &notify)
bool isPropertyConstant() const
bool isTypeConstant() const
void setType(const QSharedPointer< const QQmlJSScope > &type)
QString propertyName() const
void setIsPointer(bool isPointer)
virtual QQmlSourceLocation sourceLocation() const
\inmodule QtQmlCompiler
Definition qqmlsa.h:53
Element attachedType() const
Returns the attached type if the content type of this binding is AttachedProperty,...
Definition qqmlsa.cpp:384
BindingType bindingType() const
Returns the type of this binding.
Definition qqmlsa.cpp:350
Element bindingScope() const
Returns the Element scope in which the binding is defined.
Definition qqmlsa.cpp:342
friend bool operator!=(const Binding &lhs, const Binding &rhs)
Returns true if lhs and rhs are not equal, and false otherwise.
Definition qqmlsa.h:107
bool hasUndefinedScriptValue() const
Returns whether this binding has script value type undefined like when it is assigned undefined.
Definition qqmlsa.cpp:451
Binding(const Binding &)
Creates a copy of other.
Definition qqmlsa.cpp:254
Binding & operator=(const Binding &)
Assigns other to this Binding instance.
Definition qqmlsa.cpp:266
bool isAttached() const
Returns true if this type is attached to another one, false otherwise.
Definition qqmlsa.cpp:375
bool hasObject() const
Returns true if this binding has an objects, otherwise returns false.
Definition qqmlsa.cpp:432
friend bool operator==(const Binding &lhs, const Binding &rhs)
Returns true if lhs and rhs are equal, and false otherwise.
Definition qqmlsa.h:103
static bool isLiteralBinding(BindingType)
Returns true if bindingType is a literal type, and false otherwise.
Definition qqmlsa.cpp:475
QString propertyName() const
Returns the name of the property bound with this binding.
Definition qqmlsa.cpp:367
Binding()
Constructs a new Binding object.
Definition qqmlsa.cpp:247
QString stringValue() const
Returns the associated string literal if the content type of this binding is StringLiteral,...
Definition qqmlsa.cpp:359
Element objectType() const
Returns the type of the associated object if the content type of this binding is Object,...
Definition qqmlsa.cpp:441
Binding & operator=(Binding &&) noexcept
Move-assigns other to this Binding instance.
Definition qqmlsa.cpp:282
QQmlSA::SourceLocation sourceLocation() const
Returns the location in the QML code where this binding is defined.
Definition qqmlsa.cpp:405
ScriptBindingKind scriptKind() const
Returns the kind of the associated script if the content type of this binding is Script,...
Definition qqmlsa.cpp:424
double numberValue() const
Returns the associated number if the content type of this binding is NumberLiteral,...
Definition qqmlsa.cpp:415
Element groupType() const
Returns the type of the property of this binding if it is a group property, otherwise returns an inva...
Definition qqmlsa.cpp:334
bool hasFunctionScriptValue() const
Returns whether this binding has script value type function like when it is assigned a (lambda) metho...
Definition qqmlsa.cpp:464
\inmodule QtQmlCompiler
Definition qqmlsa.h:378
QString replacement() const
Returns the replacement string of the edit.
Definition qqmlsa.cpp:2123
QString filename() const
Returns the file this edit applies to.
Definition qqmlsa.cpp:2105
DocumentEdit(const DocumentEdit &)
Creates a copy of other.
Definition qqmlsa.cpp:2058
\inmodule QtQmlCompiler
Definition qqmlsa.h:369
\inmodule QtQmlCompiler
Definition qqmlsa.h:203
\inmodule QtQmlCompiler
Definition qqmlsa.h:406
FixSuggestion(const QString &description, const QQmlSA::SourceLocation &location, const QList< DocumentEdit > &documentEdits={})
Creates a FixSuggestion object.
Definition qqmlsa.cpp:2214
void addDocumentEdit(const DocumentEdit &)
Adds a document edit to the list of edits for this fix.
Definition qqmlsa.cpp:2286
FixSuggestion(const FixSuggestion &)
Creates a copy of other.
Definition qqmlsa.cpp:2223
QString description() const
Returns the description of the fix.
Definition qqmlsa.cpp:2268
bool isAutoApplicable() const
Returns whether this suggested fix can be applied automatically.
Definition qqmlsa.cpp:2330
void setAutoApplicable(bool autoApplicable=true)
Sets autoApplicable to determine whether this suggested fix can be applied automatically.
Definition qqmlsa.cpp:2321
QList< DocumentEdit > documentEdits() const
Returns the list of document edits that applying this fix would make.
Definition qqmlsa.cpp:2295
\inmodule QtQmlCompiler
Definition qqmlsa.h:284
void emitWarning(QAnyStringView diagnostic, LoggerWarningId id)
Emits a warning message diagnostic about an issue of type id.
Definition qqmlsa.cpp:1269
Element resolveLiteralType(const Binding &binding)
Returns the element representing the type of literal in binding.
Definition qqmlsa.cpp:1382
void emitWarning(QAnyStringView diagnostic, LoggerWarningId id, QQmlSA::SourceLocation srcLocation, const QQmlSA::FixSuggestion &fix)
Emits a warning message diagnostic about an issue of type id located at srcLocation and with suggeste...
Definition qqmlsa.cpp:1292
void emitWarning(QAnyStringView diagnostic, LoggerWarningId id, QQmlSA::SourceLocation srcLocation)
Emits warning message diagnostic about an issue of type id located at srcLocation.
Definition qqmlsa.cpp:1278
Element resolveBuiltinType(QAnyStringView typeName) const
Returns the type of the built-in type identified by typeName.
Definition qqmlsa.cpp:1354
Element resolveAttached(QAnyStringView moduleName, QAnyStringView typeName)
Returns the attached type of typeName defined in module moduleName.
Definition qqmlsa.cpp:1372
QString resolveElementToId(const Element &element, const Element &context)
Returns the id of element in a given context.
Definition qqmlsa.cpp:1405
Element resolveTypeInFileScope(QAnyStringView typeName)
Returns the type corresponding to typeName inside the currently analysed file.
Definition qqmlsa.cpp:1307
QString sourceCode(QQmlSA::SourceLocation location)
Returns the source code located within location.
Definition qqmlsa.cpp:1417
Element resolveAttachedInFileScope(QAnyStringView typeName)
Returns the attached type corresponding to typeName used inside the currently analysed file.
Definition qqmlsa.cpp:1319
Element resolveIdToElement(QAnyStringView id, const Element &context)
Returns the element in context that has id id.
Definition qqmlsa.cpp:1393
Element resolveType(QAnyStringView moduleName, QAnyStringView typeName)
Returns the type of typeName defined in module moduleName.
Definition qqmlsa.cpp:1337
\inmodule QtQmlCompiler
Definition qqmlsa.h:341
\inmodule QtQmlCompiler
Definition qqmlsa.h:121
Method & operator=(Method &&) noexcept
Move-assigns other to this Method instance.
Definition qqmlsa.cpp:624
MethodType methodType() const
Returns the type of this method.
Definition qqmlsa.cpp:651
Method(const Method &)
Creates a copy of other.
Definition qqmlsa.cpp:598
Method()
Constructs a new Method object.
Definition qqmlsa.cpp:593
Method & operator=(const Method &)
Assigns other to this Method instance.
Definition qqmlsa.cpp:611
QString methodName() const
Returns the name of the this method.
Definition qqmlsa.cpp:642
\inmodule QtQmlCompiler
Definition qqmlsa.h:315
void analyze(const Element &root)
Runs the element passes over root and all its children.
Definition qqmlsa.cpp:1607
bool isCategoryEnabled(LoggerWarningId category) const
Returns true if warnings of category are enabled, false otherwise.
Definition qqmlsa.cpp:1718
bool registerPropertyPass(std::shared_ptr< PropertyPass > pass, QAnyStringView moduleName, QAnyStringView typeName, QAnyStringView propertyName=QAnyStringView(), bool allowInheritance=true)
Registers a static analysis pass for properties.
Definition qqmlsa.cpp:1509
std::unordered_map< quint32, Binding > bindingsByLocation() const
Returns bindings by their source location.
Definition qqmlsa.cpp:1948
bool hasImportedModule(QAnyStringView name) const
Returns true if the module named module has been imported by the QML to be analyzed,...
Definition qqmlsa.cpp:1710
\inmodule QtQmlCompiler
Definition qqmlsa.h:352
\inmodule QtQmlCompiler
Definition qqmlsa.h:170
Property(const Property &)
Creates a copy of other.
Definition qqmlsa.cpp:779
QString typeName() const
Returns the name of the type of this property.
Definition qqmlsa.cpp:824
bool isReadonly() const
Returns true if this property is read-only, false otherwise.
Definition qqmlsa.cpp:842
\inmodule QtQmlCompiler
MethodType
Definition qqmlsa.h:49
AccessSemantics
Definition qqmlsa.h:50
Combined button and popup list for selecting options.
Q_DECLARE_INTERFACE(QNetworkAccessBackendFactory, QNetworkAccessBackendFactory_iid)
static QString toNumericString(double value)
static QString messageTypeForMethod(const QString &method)
static QString derefContentPointer(const QString &contentPointer)
static bool canTypeBeAffectedBySideEffects(const QQmlJSTypeResolver *typeResolver, const QQmlJSRegisterContent &baseType)
#define BYTECODE_UNIMPLEMENTED()
#define INJECT_TRACE_INFO(function)
#define REJECT
static QString registerName(int registerIndex, int offset)
static QString minExpression(int argc)
static QString maxExpression(int argc)
static bool isTypeStorable(const QQmlJSTypeResolver *resolver, const QQmlJSScope::ConstPtr &type)
QQmlSA::MethodType QQmlJSMetaMethodType
QQmlJSMetaParameter QQmlJSMetaReturnType
ScriptBindingValueType
@ ScriptValue_Function
@ ScriptValue_Unknown
@ ScriptValue_Undefined
#define QmlLintPluginInterface_iid
Definition qqmlsa.h:450