QQmlSA::GenericPass Class

class QQmlSA::GenericPass

静态分析传递的基类。更多

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

QQmlSA::ElementPassQQmlSA::PropertyPass

状态:技术预览

公共函数

GenericPass(QQmlSA::PassManager *manager)
virtual ~GenericPass()
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)

详细说明

该类包含更多特定通行证使用的常用功能。自定义通行证不应直接派生自该类,而应派生自其子类之一。

另请参阅 ElementPassPropertyPass

成员函数文档

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

创建通用通行证。

[virtual noexcept] GenericPass::~GenericPass()

销毁GenericPass 实例。

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

id 类型的问题发出警告信息diagnostic

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

就位于srcLocationid 类型问题发出警告信息diagnostic

void GenericPass::emitWarning(QAnyStringView diagnostic, QQmlSA::LoggerWarningId id, QQmlSA::SourceLocation srcLocation, const QQmlSA::FixSuggestion &fix)

发出警告信息diagnostic ,涉及位于srcLocationid 类型的问题,并建议fix 进行修复。

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

返回模块moduleName 中定义的typeName 的附加类型。

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

返回当前分析文件中使用的typeName 所对应的附件类型。

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

返回由typeName 标识的内置类型的类型。内置类型包括 QML 引擎无需导入即可处理的C++ 类型(如QDateTimeQString )、全局 EcmaScript 对象(如Number )以及全局 Qt 对象

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

返回给定contextelement 的 id。

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

返回context 中 id 为id 的元素。

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

返回binding 中代表字面量类型的元素。如果绑定不包含字面量值,则返回空元素。

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

返回模块moduleName 中定义的typeName 类型。如果附加类型和非附加类型同名(例如ListView ),则返回非附加类型对应的Element 。要获取附加类型,请使用resolveAttached

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

返回当前分析文件中typeName 对应的类型。

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

返回位于location 中的源代码。

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.