| 1 | // Copyright (C) 2021 The Qt Company Ltd. |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 |
| 3 | |
| 4 | #ifndef QMLTCTYPERESOLVER_H |
| 5 | #define QMLTCTYPERESOLVER_H |
| 6 | |
| 7 | #include "qmltcvisitor.h" |
| 8 | |
| 9 | #include <QtQml/private/qqmlirbuilder_p.h> |
| 10 | #include <private/qqmljstyperesolver_p.h> |
| 11 | #include <private/qqmljsimporter_p.h> |
| 12 | #include <private/qqmljslogger_p.h> |
| 13 | |
| 14 | QT_BEGIN_NAMESPACE |
| 15 | |
| 16 | class QmltcTypeResolver : public QQmlJSTypeResolver |
| 17 | { |
| 18 | public: |
| 19 | QmltcTypeResolver(QQmlJSImporter *importer) : QQmlJSTypeResolver(importer), m_importer(importer) |
| 20 | { |
| 21 | Q_ASSERT(importer); |
| 22 | } |
| 23 | |
| 24 | void init(QmltcVisitor *visitor, QQmlJS::AST::Node *program); |
| 25 | |
| 26 | QQmlJSScope::Ptr scopeForLocation(const QV4::CompiledData::Location &location) const; |
| 27 | |
| 28 | // returns an import pair {url, modifiable type} for a given \a type |
| 29 | QPair<QString, QQmlJSScope::Ptr> importedType(const QQmlJSScope::ConstPtr &type) const; |
| 30 | |
| 31 | private: |
| 32 | QQmlJSImporter *m_importer = nullptr; |
| 33 | |
| 34 | QHash<QV4::CompiledData::Location, QQmlJSScope::Ptr> m_objectsByLocationNonConst; |
| 35 | QQmlJSScope::Ptr m_root; |
| 36 | }; |
| 37 | |
| 38 | QT_END_NAMESPACE |
| 39 | |
| 40 | #endif // QMLTCTYPERESOLVER_H |
| 41 |
