aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmlcompiler
diff options
context:
space:
mode:
Diffstat (limited to 'src/qmlcompiler')
-rw-r--r--src/qmlcompiler/qqmljsimportvisitor.cpp4
-rw-r--r--src/qmlcompiler/qqmlsa.cpp10
-rw-r--r--src/qmlcompiler/qqmlsa_p.h4
3 files changed, 17 insertions, 1 deletions
diff --git a/src/qmlcompiler/qqmljsimportvisitor.cpp b/src/qmlcompiler/qqmljsimportvisitor.cpp
index 48c4bcbeef..0f79034bc6 100644
--- a/src/qmlcompiler/qqmljsimportvisitor.cpp
+++ b/src/qmlcompiler/qqmljsimportvisitor.cpp
@@ -1773,7 +1773,9 @@ QQmlJSImportVisitor::parseBindingExpression(const QString &name,
}
auto expr = exprStatement->expression;
- QQmlJSMetaPropertyBinding binding(expr->firstSourceLocation(), name);
+ QQmlJSMetaPropertyBinding binding(
+ combine(expr->firstSourceLocation(), expr->lastSourceLocation()),
+ name);
bool isUndefinedBinding = false;
diff --git a/src/qmlcompiler/qqmlsa.cpp b/src/qmlcompiler/qqmlsa.cpp
index 0b6e88ef7c..9dde74ad86 100644
--- a/src/qmlcompiler/qqmlsa.cpp
+++ b/src/qmlcompiler/qqmlsa.cpp
@@ -49,6 +49,16 @@ Element GenericPass::resolveLiteralType(const QQmlJSMetaPropertyBinding &binding
return binding.literalType(d->manager->m_typeResolver);
}
+Element GenericPass::resolveId(QAnyStringView id, const Element &context)
+{
+ return d->manager->m_typeResolver->scopeForId(id.toString(), context);
+}
+
+QString GenericPass::sourceCode(QQmlJS::SourceLocation location)
+{
+ return d->manager->m_visitor->logger()->code().mid(location.offset, location.length);
+}
+
/*!
* \brief PassManager::registerElementPass registers ElementPass
with the pass manager.
diff --git a/src/qmlcompiler/qqmlsa_p.h b/src/qmlcompiler/qqmlsa_p.h
index 67b6995b54..e43ba9ed4e 100644
--- a/src/qmlcompiler/qqmlsa_p.h
+++ b/src/qmlcompiler/qqmlsa_p.h
@@ -50,6 +50,10 @@ public:
QQmlJS::SourceLocation srcLocation = QQmlJS::SourceLocation());
Element resolveType(QAnyStringView moduleName, QAnyStringView typeName); // #### TODO: revisions
Element resolveLiteralType(const QQmlJSMetaPropertyBinding &binding);
+ Element resolveId(QAnyStringView id, const Element &context);
+
+ QString sourceCode(QQmlJS::SourceLocation location);
+
private:
std::unique_ptr<GenericPassPrivate> d; // PIMPL might be overkill