Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QQmltc::Visitor Class Reference

#include <qqmltcvisitor_p.h>

Inheritance diagram for QQmltc::Visitor:
Collaboration diagram for QQmltc::Visitor:

Public Types

enum  Mode { Import , Compile }

Public Member Functions

 Visitor (QQmlJSImporter *importer, QQmlJSLogger *logger, const QString &implicitImportDirectory, const QStringList &qmldirFiles=QStringList())
bool visit (QQmlJS::AST::UiObjectDefinition *) override
void endVisit (QQmlJS::AST::UiObjectDefinition *) override
bool visit (QQmlJS::AST::UiObjectBinding *) override
void endVisit (QQmlJS::AST::UiObjectBinding *) override
bool visit (QQmlJS::AST::UiScriptBinding *) override
bool visit (QQmlJS::AST::UiPublicMember *) override
bool visit (QQmlJS::AST::UiInlineComponent *) override
void endVisit (QQmlJS::AST::UiProgram *) override
QList< QQmlJSScope::ConstPtrqmlTypesWithQmlBases (const InlineComponentOrDocumentRootName &inlinedComponentName) const
QSet< QStringcppIncludeFiles () const
qsizetype creationIndex (const QQmlJSScope::ConstPtr &type) const
qsizetype typeCount (const InlineComponentOrDocumentRootName &inlineComponent) const
qsizetype qmlComponentIndex (const QQmlJSScope::ConstPtr &type) const
qsizetype qmlIrObjectIndex (const QQmlJSScope::ConstPtr &type) const
int runtimeId (const QQmlJSScope::ConstPtr &type) const
QList< QQmlJSScope::ConstPtrallQmlTypes () const
QList< QQmlJSScope::ConstPtrpureQmlTypes (const InlineComponentOrDocumentRootName &inlineComponent) const
QList< InlineComponentOrDocumentRootNameinlineComponentNames () const
QQmlJSScope::ConstPtr inlineComponent (const InlineComponentOrDocumentRootName &inlineComponentName) const
bool hasDeferredBindings (const QQmlJSScope::ConstPtr &type) const
void setMode (Mode mode)
bool checkCustomParser (const QQmlJSScope::ConstPtr &scope) override
bool hasSeenCustomParsers () const
Public Member Functions inherited from QQmlJSImportVisitor
 QQmlJSImportVisitor (QQmlJSImporter *importer, QQmlJSLogger *logger, const QString &implicitImportDirectory, const QStringList &qmldirFiles=QStringList())
 ~QQmlJSImportVisitor ()
QQmlJSScope::Ptr result () const
const QQmlJSLoggerlogger () const
QQmlJSLoggerlogger ()
QQmlJSImporter::ImportedTypes imports () const
QQmlJSScopesById addressableScopes () const
QDuplicateTracker< QQmlJSScope::ConstPtr > * knownUnresolvedTypes ()
QHash< QQmlJS::SourceLocation, QQmlJSMetaSignalHandlersignalHandlers () const
QList< QQmlJSScope::ConstPtrqmlTypes () const
QHash< QV4::CompiledData::Location, QQmlJSScope::ConstPtrscopesBylocation () const
QQmlJSImporterimporter ()
const QQmlJSImporterimporter () const
QStringList seenModuleQualifiers () const
void postVisit (Node *) override
bool preVisit (Node *) override
Public Member Functions inherited from QQmlJS::AST::Visitor
 Visitor (quint16 parentRecursionDepth=0)
bool preVisit (Node *) override
void postVisit (Node *) override
Public Member Functions inherited from QQmlJS::AST::BaseVisitor
 BaseVisitor (quint16 parentRecursionDepth=0)
virtual ~BaseVisitor ()
quint16 recursionDepth () const

Protected Member Functions

QList< QQmlJSScope::ConstPtrqmlTypes () const
Protected Member Functions inherited from QQmlJSImportVisitor
bool visit (QQmlJS::AST::ExpressionStatement *ast) override
void endVisit (QQmlJS::AST::ExpressionStatement *ast) override
bool visit (QQmlJS::AST::UiProgram *) override
void endVisit (QQmlJS::AST::UiProgram *) override
bool visit (QQmlJS::AST::UiObjectDefinition *) override
void endVisit (QQmlJS::AST::UiObjectDefinition *) override
bool visit (QQmlJS::AST::UiInlineComponent *) override
void endVisit (QQmlJS::AST::UiInlineComponent *) override
bool visit (QQmlJS::AST::UiPublicMember *) override
void endVisit (QQmlJS::AST::UiPublicMember *) override
bool visit (QQmlJS::AST::UiRequired *required) override
bool visit (QQmlJS::AST::UiScriptBinding *) override
void endVisit (QQmlJS::AST::UiScriptBinding *) override
bool visit (QQmlJS::AST::UiArrayBinding *) override
void endVisit (QQmlJS::AST::UiArrayBinding *) override
bool visit (QQmlJS::AST::UiEnumDeclaration *uied) override
bool visit (QQmlJS::AST::FunctionExpression *fexpr) override
void endVisit (QQmlJS::AST::FunctionExpression *) override
bool visit (QQmlJS::AST::UiSourceElement *) override
bool visit (QQmlJS::AST::FunctionDeclaration *fdecl) override
void endVisit (QQmlJS::AST::FunctionDeclaration *) override
bool visit (QQmlJS::AST::ClassExpression *ast) override
void endVisit (QQmlJS::AST::ClassExpression *) override
bool visit (QQmlJS::AST::UiImport *import) override
bool visit (QQmlJS::AST::UiPragma *pragma) override
bool visit (QQmlJS::AST::ClassDeclaration *ast) override
void endVisit (QQmlJS::AST::ClassDeclaration *ast) override
bool visit (QQmlJS::AST::ForStatement *ast) override
void endVisit (QQmlJS::AST::ForStatement *ast) override
bool visit (QQmlJS::AST::ForEachStatement *ast) override
void endVisit (QQmlJS::AST::ForEachStatement *ast) override
bool visit (QQmlJS::AST::Block *ast) override
void endVisit (QQmlJS::AST::Block *ast) override
bool visit (QQmlJS::AST::CaseBlock *ast) override
void endVisit (QQmlJS::AST::CaseBlock *ast) override
bool visit (QQmlJS::AST::Catch *ast) override
void endVisit (QQmlJS::AST::Catch *ast) override
bool visit (QQmlJS::AST::WithStatement *withStatement) override
void endVisit (QQmlJS::AST::WithStatement *ast) override
bool visit (QQmlJS::AST::FormalParameterList *fpl) override
bool visit (QQmlJS::AST::UiObjectBinding *uiob) override
void endVisit (QQmlJS::AST::UiObjectBinding *uiob) override
bool visit (QQmlJS::AST::ExportDeclaration *exp) override
void endVisit (QQmlJS::AST::ExportDeclaration *exp) override
bool visit (QQmlJS::AST::ESModule *module) override
void endVisit (QQmlJS::AST::ESModule *module) override
bool visit (QQmlJS::AST::Program *program) override
void endVisit (QQmlJS::AST::Program *program) override
void endVisit (QQmlJS::AST::FieldMemberExpression *) override
bool visit (QQmlJS::AST::IdentifierExpression *idexp) override
bool visit (QQmlJS::AST::PatternElement *) override
bool visit (QQmlJS::AST::IfStatement *) override
void throwRecursionDepthError () override
void setScopeName (QQmlJSScope::Ptr &scope, QQmlJSScope::ScopeType type, const QString &name)
virtual bool safeInsertJSIdentifier (QQmlJSScope::Ptr &scope, const QString &name, const QQmlJSScope::JavaScriptIdentifier &identifier)
void createAttachedAndGroupedScopes (QQmlJS::AST::UiQualifiedId *propertyName)
int openAttachedAndGroupedScopes (QQmlJS::AST::UiQualifiedId *propertyName)
QQmlJSMetaMethod::RelativeFunctionIndex addFunctionOrExpression (const QQmlJSScope::ConstPtr &scope, const QString &name)
void forgetFunctionExpression (const QString &name)
int synthesizeCompilationUnitRuntimeFunctionIndices (const QQmlJSScope::Ptr &scope, int count) const
void populateRuntimeFunctionIndicesForDocument () const
void enterEnvironment (QQmlJSScope::ScopeType type, const QString &name, const QQmlJS::SourceLocation &location)
bool enterEnvironmentNonUnique (QQmlJSScope::ScopeType type, const QString &name, const QQmlJS::SourceLocation &location)
virtual void leaveEnvironment ()
template<typename ErrorHandler>
bool checkTypeResolved (const QQmlJSScope::ConstPtr &type, ErrorHandler handle)
bool checkTypeResolved (const QQmlJSScope::ConstPtr &type)
void warnUnresolvedType (const QQmlJSScope::ConstPtr &type) const
void warnMissingPropertyForBinding (const QString &property, const QQmlJS::SourceLocation &location, const std::optional< QQmlJSFixSuggestion > &fixSuggestion={})
QList< QQmlJSAnnotationparseAnnotations (QQmlJS::AST::UiAnnotationList *list)
void setAllBindings ()
void addDefaultProperties ()
void processDefaultProperties ()
void processPropertyBindings ()
void checkRequiredProperties ()
void processPropertyTypes ()
void processMethodTypes ()
void processPropertyBindingObjects ()
void flushPendingSignalParameters ()
void breakInheritanceCycles (const QQmlJSScope::Ptr &scope)
void checkDeprecation (const QQmlJSScope::ConstPtr &scope)
void checkGroupedAndAttachedScopes (QQmlJSScope::ConstPtr scope)
void checkForComponentTypeWithProperties (const QQmlJSScope::ConstPtr &scope)
bool rootScopeIsValid () const
virtual BindingExpressionParseResult parseBindingExpression (const QString &name, const QQmlJS::AST::Statement *statement, const QQmlJS::AST::UiPublicMember *associatedPropertyDefinition=nullptr)
bool isImportPrefix (QString prefix) const

Protected Attributes

QStringList m_qmlTypeNames
QHash< QString, int > m_qmlTypeNameCounts
QHash< InlineComponentOrDocumentRootName, QList< QQmlJSScope::ConstPtr > > m_qmlTypesWithQmlBases
QSet< QStringm_cppIncludes
QHash< InlineComponentOrDocumentRootName, QList< QQmlJSScope::ConstPtr > > m_pureQmlTypes
QList< InlineComponentOrDocumentRootNamem_inlineComponentNames
QHash< InlineComponentOrDocumentRootName, QQmlJSScope::Ptrm_inlineComponents
QHash< QQmlJSScope::ConstPtr, qsizetypem_creationIndices
QHash< InlineComponentOrDocumentRootName, qsizetypem_inlineComponentTypeCount
QHash< QQmlJSScope::ConstPtr, qsizetypem_syntheticTypeIndices
QHash< QQmlJSScope::ConstPtr, qsizetypem_qmlIrObjectIndices
QSet< QQmlJSScope::ConstPtrm_typesWithDeferredBindings
QHash< QQmlJSScope::ConstPtr, int > m_typesWithId
Mode m_mode = Mode::Import
bool m_seenCustomParsers = false
Protected Attributes inherited from QQmlJSImportVisitor
QString m_implicitImportDirectory
QStringList m_qmldirFiles
QQmlJSScope::Ptr m_currentScope
const QQmlJSScope::Ptr m_exportedRootScope
QQmlJSImporterm_importer = nullptr
QQmlJSLoggerm_logger = nullptr
QQmlJSScope::InlineComponentOrDocumentRootName m_currentRootName
bool m_nextIsInlineComponent = false
bool m_rootIsSingleton = false
QQmlJSScope::Ptr m_savedBindingOuterScope
QQmlJSScope::ConstPtr m_globalScope
QQmlJSScopesById m_scopesById
QQmlJSImporter::ImportedTypes m_rootScopeImports
QList< QQmlJSScope::ConstPtrm_qmlTypes
QHash< QV4::CompiledData::Location, QQmlJSScope::ConstPtrm_scopesByIrLocation
QMultiHash< QString, QQmlJS::SourceLocationm_importTypeLocationMap
QMultiHash< QString, QQmlJS::SourceLocationm_importStaticModuleLocationMap
QSet< QQmlJS::SourceLocationm_importLocations
QSet< QStringm_usedTypes
QList< UnfinishedBindingm_bindings
QHash< QQmlJSScope::ConstPtr, QList< QString > > m_functionsAndExpressions
bool m_thisScriptBindingIsJavaScript = false
QStack< FunctionOrExpressionIdentifierm_functionStack
QHash< FunctionOrExpressionIdentifier, int > m_innerFunctions
QDuplicateTracker< QQmlJSScope::ConstPtrm_unresolvedTypes
QList< QQmlJSAnnotationm_pendingMethodAnnotations
QHash< QQmlJSScope::Ptr, QList< QQmlJSScope::Ptr > > m_pendingDefaultProperties
QList< PendingPropertyTypem_pendingPropertyTypes
QList< PendingMethodTypeAnnotationsm_pendingMethodTypeAnnotations
QList< PendingPropertyObjectBindingm_pendingPropertyObjectBindings
QList< RequiredPropertym_requiredProperties
QList< QQmlJSScope::Ptrm_objectBindingScopes
QList< QQmlJSScope::Ptrm_objectDefinitionScopes
QHash< QQmlJSScope::Ptr, QList< WithVisibilityScope< QString > > > m_propertyBindings
QList< Aliasm_aliasDefinitions
QHash< Property, QList< Alias > > m_propertyAliases
QHash< QQmlJS::SourceLocation, QQmlJSMetaSignalHandlerm_signalHandlers
QQmlJS::SourceLocation m_pendingSignalHandler
QStringList m_seenModuleQualifiers
QHash< QStringView, QQmlJS::SourceLocationm_seenInlineComponents
Protected Attributes inherited from QQmlJS::AST::BaseVisitor
quint16 m_recursionDepth = 0

Additional Inherited Members

Static Public Member Functions inherited from QQmlJSImportVisitor
static QString implicitImportDirectory (const QString &localFile, QQmlJSResourceFileMapper *mapper)
Protected Types inherited from QQmlJSImportVisitor
enum class  BindingExpressionParseResult { Invalid , Script , Literal , Translation }
enum class  BindingForPropertyDefintion { Yes , No }
using RootDocumentNameType = QQmlJSScope::RootDocumentNameType
using InlineComponentNameType = QQmlJSScope::InlineComponentNameType
using InlineComponentOrDocumentRootName = QQmlJSScope::RootDocumentNameType
using ConstScopeAndName = ScopeAndNameT<true>
using ScopeAndName = ScopeAndNameT<false>
using FunctionOrExpressionIdentifier = ConstScopeAndName
using Property = ConstScopeAndName
using Alias = ConstScopeAndName

Detailed Description

Definition at line 41 of file qqmltcvisitor_p.h.

Member Enumeration Documentation

◆ Mode

Enumerator
Import 
Compile 

Definition at line 157 of file qqmltcvisitor_p.h.

Constructor & Destructor Documentation

◆ Visitor()

QQmltc::Visitor::Visitor ( QQmlJSImporter * importer,
QQmlJSLogger * logger,
const QString & implicitImportDirectory,
const QStringList & qmldirFiles = QStringList() )

Definition at line 158 of file qqmltcvisitor.cpp.

Member Function Documentation

◆ allQmlTypes()

QList< QQmlJSScope::ConstPtr > QQmltc::Visitor::allQmlTypes ( ) const
inline

Returns all encountered QML types.

Definition at line 118 of file qqmltcvisitor_p.h.

◆ checkCustomParser()

bool QQmltc::Visitor::checkCustomParser ( const QQmlJSScope::ConstPtr & scope)
overridevirtual

Reimplemented from QQmlJSImportVisitor.

Definition at line 425 of file qqmltcvisitor.cpp.

◆ cppIncludeFiles()

QSet< QString > QQmltc::Visitor::cppIncludeFiles ( ) const
inline

Definition at line 78 of file qqmltcvisitor_p.h.

◆ creationIndex()

qsizetype QQmltc::Visitor::creationIndex ( const QQmlJSScope::ConstPtr & type) const
inline

Definition at line 80 of file qqmltcvisitor_p.h.

◆ endVisit() [1/3]

void QQmltc::Visitor::endVisit ( QQmlJS::AST::UiObjectBinding * uiob)
override

Definition at line 321 of file qqmltcvisitor.cpp.

◆ endVisit() [2/3]

void QQmltc::Visitor::endVisit ( QQmlJS::AST::UiObjectDefinition * object)
override

Definition at line 300 of file qqmltcvisitor.cpp.

◆ endVisit() [3/3]

void QQmltc::Visitor::endVisit ( QQmlJS::AST::UiProgram * program)
override

Definition at line 399 of file qqmltcvisitor.cpp.

◆ hasDeferredBindings()

bool QQmltc::Visitor::hasDeferredBindings ( const QQmlJSScope::ConstPtr & type) const
inline

Returns true when type has deferred bindings. Returns false otherwise.

Definition at line 152 of file qqmltcvisitor_p.h.

◆ hasSeenCustomParsers()

bool QQmltc::Visitor::hasSeenCustomParsers ( ) const
inline

Definition at line 161 of file qqmltcvisitor_p.h.

References m_seenCustomParsers.

◆ inlineComponent()

QQmlJSScope::ConstPtr QQmltc::Visitor::inlineComponent ( const InlineComponentOrDocumentRootName & inlineComponentName) const
inline

Definition at line 143 of file qqmltcvisitor_p.h.

◆ inlineComponentNames()

QList< InlineComponentOrDocumentRootName > QQmltc::Visitor::inlineComponentNames ( ) const
inline

Returns a list of the inline components. This list ends with the document root.

Definition at line 138 of file qqmltcvisitor_p.h.

◆ pureQmlTypes()

QList< QQmlJSScope::ConstPtr > QQmltc::Visitor::pureQmlTypes ( const InlineComponentOrDocumentRootName & inlineComponent) const
inline

Returns QML types which return false in {isComponentRootElement()}. The QHash key are the enclosing inline component or the root document name when not beloning to any inline component. Called "pure", because these are the ones that are not wrapped into QQmlComponent. Pure QML types can be created through direct constructor invocation.

Definition at line 129 of file qqmltcvisitor_p.h.

◆ qmlComponentIndex()

qsizetype QQmltc::Visitor::qmlComponentIndex ( const QQmlJSScope::ConstPtr & type) const
inline

Definition at line 91 of file qqmltcvisitor_p.h.

◆ qmlIrObjectIndex()

qsizetype QQmltc::Visitor::qmlIrObjectIndex ( const QQmlJSScope::ConstPtr & type) const
inline

Definition at line 97 of file qqmltcvisitor_p.h.

◆ qmlTypes()

QList< QQmlJSScope::ConstPtr > QQmltc::Visitor::qmlTypes ( ) const
inlineprotected

Definition at line 207 of file qqmltcvisitor_p.h.

◆ qmlTypesWithQmlBases()

QList< QQmlJSScope::ConstPtr > QQmltc::Visitor::qmlTypesWithQmlBases ( const InlineComponentOrDocumentRootName & inlinedComponentName) const
inline

Definition at line 74 of file qqmltcvisitor_p.h.

◆ runtimeId()

int QQmltc::Visitor::runtimeId ( const QQmlJSScope::ConstPtr & type) const
inline

Returns a runtime index counterpart of id: foo for type. Returns -1 if type does not have an id.

Definition at line 108 of file qqmltcvisitor_p.h.

◆ setMode()

void QQmltc::Visitor::setMode ( Mode mode)
inline

Definition at line 158 of file qqmltcvisitor_p.h.

References m_mode.

◆ typeCount()

qsizetype QQmltc::Visitor::typeCount ( const InlineComponentOrDocumentRootName & inlineComponent) const
inline

Definition at line 86 of file qqmltcvisitor_p.h.

◆ visit() [1/5]

bool QQmltc::Visitor::visit ( QQmlJS::AST::UiInlineComponent * component)
override

Definition at line 392 of file qqmltcvisitor.cpp.

◆ visit() [2/5]

bool QQmltc::Visitor::visit ( QQmlJS::AST::UiObjectBinding * uiob)
override

Definition at line 307 of file qqmltcvisitor.cpp.

◆ visit() [3/5]

bool QQmltc::Visitor::visit ( QQmlJS::AST::UiObjectDefinition * object)
override

Definition at line 277 of file qqmltcvisitor.cpp.

◆ visit() [4/5]

bool QQmltc::Visitor::visit ( QQmlJS::AST::UiPublicMember * publicMember)
override

Definition at line 327 of file qqmltcvisitor.cpp.

◆ visit() [5/5]

bool QQmltc::Visitor::visit ( QQmlJS::AST::UiScriptBinding * scriptBinding)
override

Definition at line 378 of file qqmltcvisitor.cpp.

Member Data Documentation

◆ m_cppIncludes

QSet<QString> QQmltc::Visitor::m_cppIncludes
protected

Definition at line 171 of file qqmltcvisitor_p.h.

◆ m_creationIndices

QHash<QQmlJSScope::ConstPtr, qsizetype> QQmltc::Visitor::m_creationIndices
protected

Map types to their creation indices. Childrens are stored at their creation index in a QObject* array either in the document root or in the inline component they belong to. Therefore two types in the same file might have the same creation index, if they belong to different inline components.

Definition at line 193 of file qqmltcvisitor_p.h.

◆ m_inlineComponentNames

QList<InlineComponentOrDocumentRootName> QQmltc::Visitor::m_inlineComponentNames
protected

List of the names of the inline components, useful when iterating over QHash that uses those names as keys. Ends with the the document root.

Definition at line 179 of file qqmltcvisitor_p.h.

◆ m_inlineComponents

QHash<InlineComponentOrDocumentRootName, QQmlJSScope::Ptr> QQmltc::Visitor::m_inlineComponents
protected

Map inline component names to the corresponding type, and the document root name to all types not belonging to any inline component.

Definition at line 185 of file qqmltcvisitor_p.h.

◆ m_inlineComponentTypeCount

QHash<InlineComponentOrDocumentRootName, qsizetype> QQmltc::Visitor::m_inlineComponentTypeCount
protected

Counts the types (pure qml types and explicit/implicit components) per inline component. Needed to set the size of the QObject* array in the document root or the inline component they belong to.

Definition at line 200 of file qqmltcvisitor_p.h.

◆ m_mode

Mode QQmltc::Visitor::m_mode = Mode::Import
protected

Definition at line 211 of file qqmltcvisitor_p.h.

Referenced by setMode().

◆ m_pureQmlTypes

QHash<InlineComponentOrDocumentRootName, QList<QQmlJSScope::ConstPtr> > QQmltc::Visitor::m_pureQmlTypes
protected

Definition at line 173 of file qqmltcvisitor_p.h.

◆ m_qmlIrObjectIndices

QHash<QQmlJSScope::ConstPtr, qsizetype> QQmltc::Visitor::m_qmlIrObjectIndices
protected

Definition at line 202 of file qqmltcvisitor_p.h.

◆ m_qmlTypeNameCounts

QHash<QString, int> QQmltc::Visitor::m_qmlTypeNameCounts
protected

Definition at line 165 of file qqmltcvisitor_p.h.

◆ m_qmlTypeNames

QStringList QQmltc::Visitor::m_qmlTypeNames
protected

Definition at line 164 of file qqmltcvisitor_p.h.

◆ m_qmlTypesWithQmlBases

QHash<InlineComponentOrDocumentRootName, QList<QQmlJSScope::ConstPtr> > QQmltc::Visitor::m_qmlTypesWithQmlBases
protected

QML types with composite/QML base types, mapped from inline component name to types

Definition at line 170 of file qqmltcvisitor_p.h.

◆ m_seenCustomParsers

bool QQmltc::Visitor::m_seenCustomParsers = false
protected

Definition at line 213 of file qqmltcvisitor_p.h.

Referenced by hasSeenCustomParsers().

◆ m_syntheticTypeIndices

QHash<QQmlJSScope::ConstPtr, qsizetype> QQmltc::Visitor::m_syntheticTypeIndices
protected

Definition at line 201 of file qqmltcvisitor_p.h.

◆ m_typesWithDeferredBindings

QSet<QQmlJSScope::ConstPtr> QQmltc::Visitor::m_typesWithDeferredBindings
protected

Definition at line 204 of file qqmltcvisitor_p.h.

◆ m_typesWithId

QHash<QQmlJSScope::ConstPtr, int> QQmltc::Visitor::m_typesWithId
protected

Definition at line 209 of file qqmltcvisitor_p.h.


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