Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QQmlSA::GenericPass Class Reference

\inmodule QtQmlCompiler More...

#include <qqmlsa.h>

+ Inheritance diagram for QQmlSA::GenericPass:
+ Collaboration diagram for QQmlSA::GenericPass:

Public Member Functions

 GenericPass (PassManager *manager)
 Creates a generic pass.
 
virtual ~GenericPass ()
 
void emitWarning (QAnyStringView diagnostic, LoggerWarningId id)
 Emits a warning message diagnostic about an issue of type id.
 
void emitWarning (QAnyStringView diagnostic, LoggerWarningId id, QQmlSA::SourceLocation srcLocation)
 Emits warning message diagnostic about an issue of type id located at srcLocation.
 
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 suggested fix fix.
 
Element resolveTypeInFileScope (QAnyStringView typeName)
 Returns the type corresponding to typeName inside the currently analysed file.
 
Element resolveAttachedInFileScope (QAnyStringView typeName)
 Returns the attached type corresponding to typeName used inside the currently analysed file.
 
Element resolveType (QAnyStringView moduleName, QAnyStringView typeName)
 Returns the type of typeName defined in module moduleName.
 
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.
 
Element resolveLiteralType (const Binding &binding)
 Returns the element representing the type of literal in binding.
 
Element resolveIdToElement (QAnyStringView id, const Element &context)
 Returns the element in context that has id id.
 
QString resolveElementToId (const Element &element, const Element &context)
 Returns the id of element in a given context.
 
QString sourceCode (QQmlSA::SourceLocation location)
 Returns the source code located within location.
 

Detailed Description

\inmodule QtQmlCompiler

The base class for static analysis passes.

This class contains common functionality used by more specific passses. Custom passes should not directly derive from it, but rather from one of its subclasses.

See also
ElementPass, PropertyPass

Definition at line 271 of file qqmlsa.h.

Constructor & Destructor Documentation

◆ GenericPass()

QQmlSA::GenericPass::GenericPass ( PassManager * manager)

Creates a generic pass.

Definition at line 875 of file qqmlsa.cpp.

◆ ~GenericPass()

QQmlSA::GenericPass::~GenericPass ( )
virtualdefault

Member Function Documentation

◆ emitWarning() [1/3]

void QQmlSA::GenericPass::emitWarning ( QAnyStringView diagnostic,
LoggerWarningId id )

Emits a warning message diagnostic about an issue of type id.

Definition at line 881 of file qqmlsa.cpp.

References emitWarning().

Referenced by emitWarning(), VarBindingTypeValidatorPass::onBinding(), LiteralBindingCheckBase::onBinding(), QQmlJSLiteralBindingCheck::onBinding(), QQmlSA::DebugPropertyPass::onBinding(), AttachedPropertyReuse::onRead(), QQmlSA::DebugPropertyPass::onRead(), QQmlSA::DebugPropertyPass::onWrite(), QQmlSA::DebugElementPass::run(), ForbiddenChildrenPropertyValidatorPass::run(), ControlsNativeValidatorPass::run(), AnchorsValidatorPass::run(), ControlsSwipeDelegateValidatorPass::run(), and PropertyChangesValidatorPass::run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ emitWarning() [2/3]

void QQmlSA::GenericPass::emitWarning ( QAnyStringView diagnostic,
LoggerWarningId id,
QQmlSA::SourceLocation srcLocation )

Emits warning message diagnostic about an issue of type id located at srcLocation.

Definition at line 890 of file qqmlsa.cpp.

References d, QQmlSA::SourceLocationPrivate::sourceLocation(), and QQmlSA::PassManagerPrivate::visitor().

+ Here is the call graph for this function:

◆ emitWarning() [3/3]

void QQmlSA::GenericPass::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 suggested fix fix.

Definition at line 904 of file qqmlsa.cpp.

References d, QQmlSA::FixSuggestionPrivate::fixSuggestion(), QQmlSA::SourceLocationPrivate::sourceLocation(), and QQmlSA::PassManagerPrivate::visitor().

+ Here is the call graph for this function:

◆ resolveAttached()

Element QQmlSA::GenericPass::resolveAttached ( QAnyStringView moduleName,
QAnyStringView typeName )

Returns the attached type of typeName defined in module moduleName.

Definition at line 983 of file qqmlsa.cpp.

References QQmlJSScope::createQQmlSAElement(), resolveType(), QQmlJSScope::scope(), and typeName.

Referenced by AttachedPropertyTypeValidatorPass::addWarning().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resolveAttachedInFileScope()

Element QQmlSA::GenericPass::resolveAttachedInFileScope ( QAnyStringView typeName)

Returns the attached type corresponding to typeName used inside the currently analysed file.

Definition at line 931 of file qqmlsa.cpp.

References QQmlJSScope::createQQmlSAElement(), resolveTypeInFileScope(), QQmlJSScope::scope(), and typeName.

Referenced by AttachedPropertyReuse::onRead().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resolveBuiltinType()

Element QQmlSA::GenericPass::resolveBuiltinType ( QAnyStringView typeName) const

Returns the type of the built-in type identified by typeName.

Built-in types encompass {C++} types which the QML engine can handle without any imports (e.g. \l QDateTime and \l QString), global EcmaScript objects like Number, as well as the \l {QML Global Object} {global Qt object}.

Definition at line 965 of file qqmlsa.cpp.

References QQmlJSScope::createQQmlSAElement(), d, typeName, and QQmlSA::PassManagerPrivate::visitor().

Referenced by VarBindingTypeValidatorPass::VarBindingTypeValidatorPass().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resolveElementToId()

QString QQmlSA::GenericPass::resolveElementToId ( const Element & element,
const Element & context )

Returns the id of element in a given context.

Definition at line 1016 of file qqmlsa.cpp.

References context, d, QQmlJSScope::scope(), and QQmlSA::PassManagerPrivate::visitor().

Referenced by AttachedPropertyReuse::onRead().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resolveIdToElement()

Element QQmlSA::GenericPass::resolveIdToElement ( QAnyStringView id,
const Element & context )

Returns the element in context that has id id.

Definition at line 1004 of file qqmlsa.cpp.

References context, QQmlJSScope::createQQmlSAElement(), d, QQmlJSScope::scope(), toString(), and QQmlSA::PassManagerPrivate::visitor().

Referenced by PropertyChangesValidatorPass::run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resolveLiteralType()

Element QQmlSA::GenericPass::resolveLiteralType ( const Binding & binding)

Returns the element representing the type of literal in binding.

If the binding does not contain a literal value, a null Element is returned.

Definition at line 993 of file qqmlsa.cpp.

References QQmlSA::BindingPrivate::binding(), QQmlJSScope::createQQmlSAElement(), d, and QQmlSA::PassManagerPrivate::resolver().

Referenced by VarBindingTypeValidatorPass::onBinding(), and QQmlJSLiteralBindingCheck::onBinding().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resolveType()

Element QQmlSA::GenericPass::resolveType ( QAnyStringView moduleName,
QAnyStringView typeName )

Returns the type of typeName defined in module moduleName.

If an attached type and a non-attached type share the same name (for example, ListView), the \l Element corresponding to the non-attached type is returned. To obtain the attached type, use \l resolveAttached.

Definition at line 949 of file qqmlsa.cpp.

References QQmlJSScope::createQQmlSAElement(), d, and QQmlSA::PassManagerPrivate::visitor().

Referenced by ControlsNativeValidatorPass::ControlsNativeValidatorPass(), VarBindingTypeValidatorPass::VarBindingTypeValidatorPass(), ForbiddenChildrenPropertyValidatorPass::addWarning(), AttachedPropertyTypeValidatorPass::addWarning(), and resolveAttached().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resolveTypeInFileScope()

Element QQmlSA::GenericPass::resolveTypeInFileScope ( QAnyStringView typeName)

Returns the type corresponding to typeName inside the currently analysed file.

Definition at line 919 of file qqmlsa.cpp.

References QQmlJSScope::createQQmlSAElement(), d, typeName, and QQmlSA::PassManagerPrivate::visitor().

Referenced by AttachedPropertyReuse::onRead(), and resolveAttachedInFileScope().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sourceCode()

QString QQmlSA::GenericPass::sourceCode ( QQmlSA::SourceLocation location)

Returns the source code located within location.

Definition at line 1027 of file qqmlsa.cpp.

References d, and QQmlSA::PassManagerPrivate::visitor().

Referenced by PropertyChangesValidatorPass::run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

The documentation for this class was generated from the following files: