GenericPass 类

class QQmlSA ::GenericPass

The base class for static analysis passes. 更多...

头: #include <GenericPass>
CMake: find_package(Qt6 REQUIRED COMPONENTS QmlCompiler)
target_link_libraries(mytarget PRIVATE Qt6::QmlCompiler)
继承者:

QQmlSA::ElementPass and QQmlSA::PropertyPass

状态: 技术预览

公共函数

GenericPass (QQmlSA::PassManager * manager )
void emitWarning (QAnyStringView diagnostic , QQmlSA::LoggerWarningId id )
void emitWarning (QAnyStringView diagnostic , QQmlSA::LoggerWarningId id , QQmlSA::SourceLocation srcLocation )
void emitWarning (QAnyStringView diagnostic , QQmlSA::LoggerWarningId id , QQmlSA::SourceLocation srcLocation , const QQmlSA::FixSuggestion & fix )
QQmlSA::Element resolveAttached (QAnyStringView moduleName , QAnyStringView typeName )
QQmlSA::Element resolveAttachedInFileScope (QAnyStringView typeName )
QQmlSA::Element resolveBuiltinType (QAnyStringView typeName ) const
QString resolveElementToId (const QQmlSA::Element & element , const QQmlSA::Element & context )
QQmlSA::Element resolveIdToElement (QAnyStringView id , const QQmlSA::Element & context )
QQmlSA::Element resolveLiteralType (const QQmlSA::Binding & binding )
QQmlSA::Element resolveType (QAnyStringView moduleName , QAnyStringView typeName )
QQmlSA::Element resolveTypeInFileScope (QAnyStringView typeName )
QString sourceCode (QQmlSA::SourceLocation location )

详细描述

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.

另请参阅 ElementPass and PropertyPass .

成员函数文档编制

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

Creates a generic pass.

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

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

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

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

void GenericPass:: emitWarning ( QAnyStringView diagnostic , QQmlSA::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 .

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

Returns the attached type of typeName defined in module moduleName .

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

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

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

Returns the type of the built-in type identified by typeName . Built-in types encompasses C++ types which the QML engine can handle without any imports (e.g. QDateTime and QString ), global EcmaScript objects like Number , as well as the global Qt object .

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

Returns the id of element in a given context .

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

Returns the element in context that has id id .

QQmlSA::Element GenericPass:: resolveLiteralType (const QQmlSA::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.

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

Returns the type of typeName defined in module moduleName . If an attached type and and a non-attached type share the same name (e.g. ListView ), Element corresponding to the non-attached type is returned. To obtain the attached type, use resolveAttached .

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

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

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

Returns the source code located within location .