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>.
|
\inmodule QtQmlCompiler More...
#include <qqmlsa.h>
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. | |
\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.
QQmlSA::GenericPass::GenericPass | ( | PassManager * | manager | ) |
Creates a generic pass.
Definition at line 875 of file qqmlsa.cpp.
|
virtualdefault |
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().
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().
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().
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().
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().
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().
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().
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().
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().
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().
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().
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().