5#ifndef QQMLJSREGISTERCONTENT_P_H
6#define QQMLJSREGISTERCONTENT_P_H
19#include <QtCore/qhash.h>
20#include <QtCore/qstring.h>
73 enum { InvalidLookupIndex = -1 };
75 QQmlJSRegisterContent() =
default;
80 bool isNull()
const {
return !d; }
84 bool isWritable()
const;
86 ContentVariant variant()
const;
88 QString descriptiveName()
const;
89 QString containedTypeName()
const;
91 int resultLookupIndex()
const;
93 QQmlJSScope::ConstPtr storedType()
const;
94 QQmlJSScope::ConstPtr containedType()
const;
95 QQmlJSScope::ConstPtr scopeType()
const;
97 bool contains(
const QQmlJSScope::ConstPtr &type)
const {
return type == containedType(); }
98 bool isStoredIn(
const QQmlJSScope::ConstPtr &type)
const {
return type == storedType(); }
104 QQmlJSScope::ConstPtr type()
const;
106 bool isProperty()
const;
107 QQmlJSMetaProperty property()
const;
108 int baseLookupIndex()
const;
110 bool isEnumeration()
const;
111 QQmlJSMetaEnum enumeration()
const;
112 QString enumMember()
const;
114 bool isMethod()
const;
115 QList<QQmlJSMetaMethod> method()
const;
116 QQmlJSScope::ConstPtr methodType()
const;
118 bool isImportNamespace()
const;
119 uint importNamespace()
const;
120 QQmlJSScope::ConstPtr importNamespaceType()
const;
122 bool isConversion()
const;
123 QQmlJSScope::ConstPtr conversionResultType()
const;
124 QQmlJSRegisterContent conversionResultScope()
const;
125 const QList<QQmlJSRegisterContent> &conversionOrigins()
const;
127 bool isMethodCall()
const;
128 QQmlJSMetaMethod methodCall()
const;
129 bool isJavaScriptReturnValue()
const;
134 QQmlJSRegisterContent attacher()
const;
135 QQmlJSRegisterContent attachee()
const;
137 QQmlJSRegisterContent scope()
const;
138 QQmlJSRegisterContent storage()
const;
139 QQmlJSRegisterContent original()
const;
140 QQmlJSRegisterContent shadowed()
const;
142 quintptr id()
const {
return quintptr(d); }
145 friend class QQmlJSRegisterContentPool;
148 QQmlJSRegisterContent(QQmlJSRegisterContentPrivate *dd) : d(dd) {};
150 friend bool operator==(QQmlJSRegisterContent a, QQmlJSRegisterContent b)
155 friend bool operator!=(QQmlJSRegisterContent a, QQmlJSRegisterContent b)
160 friend size_t qHash(QQmlJSRegisterContent registerContent, size_t seed = 0)
162 return qHash(registerContent.d, seed);
165 QQmlJSRegisterContentPrivate *d =
nullptr;
170 Q_DISABLE_COPY_MOVE(QQmlJSRegisterContentPool)
172 using ContentVariant = QQmlJSRegisterContent::ContentVariant;
175 ~QQmlJSRegisterContentPool();
181 const QQmlJSScope::ConstPtr &type,
int resultLookupIndex, ContentVariant variant,
182 QQmlJSRegisterContent scope = {});
186 ContentVariant variant, QQmlJSRegisterContent scope);
189 const QQmlJSMetaEnum &enumeration,
const QString &enumMember, ContentVariant variant,
190 QQmlJSRegisterContent scope);
193 const QList<QQmlJSMetaMethod> &methods,
const QQmlJSScope::ConstPtr &methodType,
194 ContentVariant variant, QQmlJSRegisterContent scope);
198 QQmlJSRegisterContent scope);
201 uint importNamespaceStringId,
const QQmlJSScope::ConstPtr &importNamespaceType,
202 ContentVariant variant, QQmlJSRegisterContent scope);
205 const QList<QQmlJSRegisterContent> &origins,
const QQmlJSScope::ConstPtr &conversion,
206 QQmlJSRegisterContent conversionScope, ContentVariant variant,
207 QQmlJSRegisterContent scope);
213 QQmlJSRegisterContent content,
const QQmlJSScope::ConstPtr &newStoredType);
216 QQmlJSRegisterContent content,
const QQmlJSScope::ConstPtr &newContainedType);
227 QQmlJSRegisterContent content,
const QQmlJSScope::ConstPtr &stored);
229 QQmlJSRegisterContent content,
const QQmlJSScope::ConstPtr &adjusted);
231 QQmlJSRegisterContent content,
const QQmlJSScope::ConstPtr &generalized);
240 template<
typename Private>
241 constexpr void operator()(Private *d)
const {
delete d; }
244 using Pool = std::vector<std::unique_ptr<QQmlJSRegisterContentPrivate, Deleter>>;
251 qsizetype m_checkpoint = -1;
friend bool operator==(const QByteArray::FromBase64Result &lhs, const QByteArray::FromBase64Result &rhs) noexcept
Returns true if lhs and rhs are equal, otherwise returns false.
friend bool operator!=(const QByteArray::FromBase64Result &lhs, const QByteArray::FromBase64Result &rhs) noexcept
Returns true if lhs and rhs are different, otherwise returns false.
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.
QJSManagedValue & operator=(QJSManagedValue &&other)
Move-assigns a QJSManagedValue from other.
virtual Type type() const =0
Reimplement this function to return the paint engine \l{Type}.
virtual bool isValid() const
QQmlJSRegisterContent createMethod(const QList< QQmlJSMetaMethod > &methods, const QQmlJSScope::ConstPtr &methodType, ContentVariant variant, QQmlJSRegisterContent scope)
QQmlJSRegisterContent createImportNamespace(uint importNamespaceStringId, const QQmlJSScope::ConstPtr &importNamespaceType, ContentVariant variant, QQmlJSRegisterContent scope)
QQmlJSRegisterContent createProperty(const QQmlJSMetaProperty &property, int baseLookupIndex, int resultLookupIndex, ContentVariant variant, QQmlJSRegisterContent scope)
void adjustType(QQmlJSRegisterContent content, const QQmlJSScope::ConstPtr &adjusted)
void generalizeType(QQmlJSRegisterContent content, const QQmlJSScope::ConstPtr &generalized)
void storeType(QQmlJSRegisterContent content, const QQmlJSScope::ConstPtr &stored)
QQmlJSRegisterContent castTo(QQmlJSRegisterContent content, const QQmlJSScope::ConstPtr &newContainedType)
QQmlJSRegisterContent createEnumeration(const QQmlJSMetaEnum &enumeration, const QString &enumMember, ContentVariant variant, QQmlJSRegisterContent scope)
void setAllocationMode(AllocationMode mode)
QQmlJSRegisterContent storedIn(QQmlJSRegisterContent content, const QQmlJSScope::ConstPtr &newStoredType)
QQmlJSRegisterContent clone(QQmlJSRegisterContent from)
QQmlJSRegisterContentPool()
QQmlJSRegisterContent createType(const QQmlJSScope::ConstPtr &type, int resultLookupIndex, ContentVariant variant, QQmlJSRegisterContent scope={})
QQmlJSRegisterContent createConversion(const QList< QQmlJSRegisterContent > &origins, const QQmlJSScope::ConstPtr &conversion, QQmlJSRegisterContent conversionScope, ContentVariant variant, QQmlJSRegisterContent scope)
QQmlJSRegisterContent createMethodCall(const QQmlJSMetaMethod &method, const QQmlJSScope::ConstPtr &returnType, QQmlJSRegisterContent scope)
virtual QQmlSourceLocation sourceLocation() const
Element attachedType() const
Returns the attached type if the content type of this binding is AttachedProperty,...
BindingType bindingType() const
Returns the type of this binding.
Element bindingScope() const
Returns the Element scope in which the binding is defined.
friend bool operator!=(const Binding &lhs, const Binding &rhs)
Returns true if lhs and rhs are not equal, and false otherwise.
bool hasUndefinedScriptValue() const
Returns whether this binding has script value type undefined like when it is assigned undefined.
Binding(const Binding &)
Creates a copy of other.
Binding & operator=(const Binding &)
Assigns other to this Binding instance.
bool isAttached() const
Returns true if this type is attached to another one, false otherwise.
bool hasObject() const
Returns true if this binding has an objects, otherwise returns false.
friend bool operator==(const Binding &lhs, const Binding &rhs)
Returns true if lhs and rhs are equal, and false otherwise.
static bool isLiteralBinding(BindingType)
Returns true if bindingType is a literal type, and false otherwise.
QString propertyName() const
Returns the name of the property bound with this binding.
Binding()
Constructs a new Binding object.
QString stringValue() const
Returns the associated string literal if the content type of this binding is StringLiteral,...
Element objectType() const
Returns the type of the associated object if the content type of this binding is Object,...
Binding & operator=(Binding &&) noexcept
Move-assigns other to this Binding instance.
QQmlSA::SourceLocation sourceLocation() const
Returns the location in the QML code where this binding is defined.
ScriptBindingKind scriptKind() const
Returns the kind of the associated script if the content type of this binding is Script,...
double numberValue() const
Returns the associated number if the content type of this binding is NumberLiteral,...
Element groupType() const
Returns the type of the property of this binding if it is a grouped property, otherwise returns an in...
bool hasFunctionScriptValue() const
Returns whether this binding has script value type function like when it is assigned a (lambda) metho...
QString replacement() const
Returns the replacement string of the edit.
QString filename() const
Returns the file this edit applies to.
DocumentEdit(const DocumentEdit &)
Creates a copy of other.
FixSuggestion(const QString &description, const QQmlSA::SourceLocation &location, const QList< DocumentEdit > &documentEdits={})
Creates a FixSuggestion object.
void addDocumentEdit(const DocumentEdit &)
Adds a document edit to the list of edits for this fix.
FixSuggestion(const FixSuggestion &)
Creates a copy of other.
QString description() const
Returns the description of the fix.
bool isAutoApplicable() const
Returns whether this suggested fix can be applied automatically.
void setAutoApplicable(bool autoApplicable=true)
Sets autoApplicable to determine whether this suggested fix can be applied automatically.
QList< DocumentEdit > documentEdits() const
Returns the list of document edits that applying this fix would make.
void emitWarning(QAnyStringView diagnostic, LoggerWarningId id)
Emits a warning message diagnostic about an issue of type id.
Element resolveLiteralType(const Binding &binding)
Returns the element representing the type of literal in binding.
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...
void emitWarning(QAnyStringView diagnostic, LoggerWarningId id, QQmlSA::SourceLocation srcLocation)
Emits warning message diagnostic about an issue of type id located at srcLocation.
Element resolveBuiltinType(QAnyStringView typeName) const
Returns the type of the built-in type identified by typeName.
Element resolveAttached(QAnyStringView moduleName, QAnyStringView typeName)
Returns the attached type of typeName defined in module moduleName.
QString resolveElementToId(const Element &element, const Element &context)
Returns the id of element in a given context.
Element resolveTypeInFileScope(QAnyStringView typeName)
Returns the type corresponding to typeName inside the currently analysed file.
QString sourceCode(QQmlSA::SourceLocation location)
Returns the source code located within location.
Element resolveAttachedInFileScope(QAnyStringView typeName)
Returns the attached type corresponding to typeName used inside the currently analysed file.
Element resolveIdToElement(QAnyStringView id, const Element &context)
Returns the element in context that has id id.
Element resolveType(QAnyStringView moduleName, QAnyStringView typeName)
Returns the type of typeName defined in module moduleName.
MethodType methodType() const
Returns the type of this method.
Method(const Method &)
Creates a copy of other.
Method()
Constructs a new Method object.
Method & operator=(const Method &)
Assigns other to this Method instance.
QString methodName() const
Returns the name of the this method.
void analyze(const Element &root)
Runs the element passes over root and all its children.
bool isCategoryEnabled(LoggerWarningId category) const
Returns true if warnings of category are enabled, false otherwise.
bool registerPropertyPass(std::shared_ptr< PropertyPass > pass, QAnyStringView moduleName, QAnyStringView typeName, QAnyStringView propertyName=QAnyStringView(), bool allowInheritance=true)
Registers a static analysis pass for properties.
std::unordered_map< quint32, Binding > bindingsByLocation() const
Returns bindings by their source location.
bool hasImportedModule(QAnyStringView name) const
Returns true if the module named module has been imported by the QML to be analyzed,...
Property(const Property &)
Creates a copy of other.
QString typeName() const
Returns the name of the type of this property.
bool isReadonly() const
Returns true if this property is read-only, false otherwise.
@ SignalHandlerFunctionScope
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)
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)
void resetFactoryImpl(QDeferredSharedPointer< T > &pointer, U &&factory)
#define QmlLintPluginInterface_iid