PassManager Class

class QQmlSA::PassManager

Can analyze an element and its children with static analysis passes. More...

Header: #include <PassManager>

Public Functions

PassManager(QQmlJSImportVisitor *visitor, QQmlJSTypeResolver *resolver)
void analyze(const Element &root)
int bindingsByLocation() const
bool hasImportedModule(QAnyStringView module) const
bool isCategoryEnabled(LoggerWarningId category) const
int propertyPasses() const

Detailed Description

\inmoduleQtQmlCompiler

Member Function Documentation

PassManager::PassManager(QQmlJSImportVisitor *visitor, QQmlJSTypeResolver *resolver)

Constructs a pass manager given an import visitor and a type resolver.

void PassManager::analyze(const Element &root)

Runs the element passes over root and all its children.

int PassManager::bindingsByLocation() const

Returns bindings by their source location.

bool PassManager::hasImportedModule(QAnyStringView module) const

Returns true if the module named module has been imported by the QML to be analyzed, false otherwise.

This can be used to skip registering a pass which is specific to a specific module.

 if (passManager->hasImportedModule("QtPositioning"))
     passManager->registerElementPass(
        std::make_unique<PositioningPass>(passManager)
     );

See also registerPropertyPass() and registerElementPass().

bool PassManager::isCategoryEnabled(LoggerWarningId category) const

Returns true if warnings of category are enabled, false otherwise.

int PassManager::propertyPasses() const

Returns the list of property passes.