aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmlcompiler/qqmljsimportvisitor_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/qmlcompiler/qqmljsimportvisitor_p.h')
-rw-r--r--src/qmlcompiler/qqmljsimportvisitor_p.h37
1 files changed, 34 insertions, 3 deletions
diff --git a/src/qmlcompiler/qqmljsimportvisitor_p.h b/src/qmlcompiler/qqmljsimportvisitor_p.h
index 1a587cbb85..b04b0a0777 100644
--- a/src/qmlcompiler/qqmljsimportvisitor_p.h
+++ b/src/qmlcompiler/qqmljsimportvisitor_p.h
@@ -14,7 +14,8 @@
//
// We mean it.
-#include <private/qtqmlcompilerexports_p.h>
+#include <private/qqmljscontextualtypes_p.h>
+#include <qtqmlcompilerexports.h>
#include "qqmljsannotation_p.h"
#include "qqmljsimporter_p.h"
@@ -33,18 +34,29 @@
QT_BEGIN_NAMESPACE
+namespace QQmlJS::Dom {
+class QQmlDomAstCreatorWithQQmlJSScope;
+}
+
struct QQmlJSResourceFileMapper;
-class Q_QMLCOMPILER_PRIVATE_EXPORT QQmlJSImportVisitor : public QQmlJS::AST::Visitor
+class Q_QMLCOMPILER_EXPORT QQmlJSImportVisitor : public QQmlJS::AST::Visitor
{
public:
+ QQmlJSImportVisitor();
QQmlJSImportVisitor(const QQmlJSScope::Ptr &target,
QQmlJSImporter *importer, QQmlJSLogger *logger,
const QString &implicitImportDirectory,
const QStringList &qmldirFiles = QStringList());
~QQmlJSImportVisitor();
+ using QQmlJS::AST::Visitor::endVisit;
+ using QQmlJS::AST::Visitor::postVisit;
+ using QQmlJS::AST::Visitor::preVisit;
+ using QQmlJS::AST::Visitor::visit;
+
QQmlJSScope::Ptr result() const { return m_exportedRootScope; }
+ const QQmlJSLogger *logger() const { return m_logger; }
QQmlJSLogger *logger() { return m_logger; }
QQmlJSImporter::ImportedTypes imports() const { return m_rootScopeImports; }
@@ -63,7 +75,9 @@ public:
static QString implicitImportDirectory(
const QString &localFile, QQmlJSResourceFileMapper *mapper);
- QQmlJSImporter *importer() { return m_importer; } // ### should this be restricted?
+ // ### should this be restricted?
+ QQmlJSImporter *importer() { return m_importer; }
+ const QQmlJSImporter *importer() const { return m_importer; }
struct UnfinishedBinding
{
@@ -246,6 +260,7 @@ protected:
void processPropertyBindings();
void checkRequiredProperties();
void processPropertyTypes();
+ void processMethodTypes();
void processPropertyBindingObjects();
void flushPendingSignalParameters();
@@ -271,6 +286,13 @@ protected:
QQmlJS::SourceLocation location;
};
+ struct PendingMethodType
+ {
+ QQmlJSScope::Ptr scope;
+ QString methodName;
+ QQmlJS::SourceLocation location;
+ };
+
struct PendingPropertyObjectBinding
{
QQmlJSScope::Ptr scope;
@@ -308,6 +330,7 @@ protected:
QHash<QQmlJSScope::Ptr, QVector<QQmlJSScope::Ptr>> m_pendingDefaultProperties;
QVector<PendingPropertyType> m_pendingPropertyTypes;
+ QVector<PendingMethodType> m_pendingMethodTypes;
QVector<PendingPropertyObjectBinding> m_pendingPropertyObjectBindings;
QVector<RequiredProperty> m_requiredProperties;
QVector<QQmlJSScope::Ptr> m_objectBindingScopes;
@@ -336,6 +359,14 @@ private:
const QQmlJS::SourceLocation &location);
void enterRootScope(QQmlJSScope::ScopeType type, const QString &name,
const QQmlJS::SourceLocation &location);
+
+ void importFromHost(const QString &path, const QString &prefix,
+ const QQmlJS::SourceLocation &location);
+ void importFromQrc(const QString &path, const QString &prefix,
+ const QQmlJS::SourceLocation &location);
+
+public:
+ friend class QQmlJS::Dom::QQmlDomAstCreatorWithQQmlJSScope;
};
QT_END_NAMESPACE