aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmlcompiler/qqmljsimportvisitor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qmlcompiler/qqmljsimportvisitor.cpp')
-rw-r--r--src/qmlcompiler/qqmljsimportvisitor.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/qmlcompiler/qqmljsimportvisitor.cpp b/src/qmlcompiler/qqmljsimportvisitor.cpp
index a1de41e3ca..8b57ac9b54 100644
--- a/src/qmlcompiler/qqmljsimportvisitor.cpp
+++ b/src/qmlcompiler/qqmljsimportvisitor.cpp
@@ -52,7 +52,7 @@ void QQmlJSImportVisitor::enterEnvironment(QQmlJSScope::ScopeType type, const QS
const QQmlJS::SourceLocation &location)
{
m_currentScope = QQmlJSScope::create(type, m_currentScope);
- if (type == QQmlJSScope::GroupedPropertyScope)
+ if (type == QQmlJSScope::GroupedPropertyScope || type == QQmlJSScope::AttachedPropertyScope)
m_currentScope->setInternalName(name);
else
m_currentScope->setBaseTypeName(name);
@@ -136,7 +136,6 @@ bool QQmlJSImportVisitor::visit(UiObjectDefinition *definition)
void QQmlJSImportVisitor::endVisit(UiObjectDefinition *)
{
m_currentScope->resolveTypes(m_rootScopeImports);
- m_currentScope->resolveGroupedScopes();
leaveEnvironment();
}
@@ -261,16 +260,20 @@ bool QQmlJSImportVisitor::visit(UiScriptBinding *scriptBinding)
for (auto group = id; group->next; group = group->next) {
const QString name = group->name.toString();
- if (name.isEmpty() || name.front().isUpper())
- break; // TODO: uppercase grouped scopes are attached properties. Handle them.
+ if (name.isEmpty())
+ break;
- enterEnvironment(QQmlJSScope::GroupedPropertyScope, name, group->firstSourceLocation());
+ enterEnvironment(name.front().isUpper() ? QQmlJSScope::AttachedPropertyScope
+ : QQmlJSScope::GroupedPropertyScope,
+ name, group->firstSourceLocation());
}
// TODO: remember the actual binding, once we can process it.
- while (m_currentScope->scopeType() == QQmlJSScope::GroupedPropertyScope)
+ while (m_currentScope->scopeType() == QQmlJSScope::GroupedPropertyScope
+ || m_currentScope->scopeType() == QQmlJSScope::AttachedPropertyScope) {
leaveEnvironment();
+ }
if (!statement || !statement->expression->asFunctionDefinition()) {
enterEnvironment(QQmlJSScope::JSFunctionScope, QStringLiteral("binding"),
@@ -497,7 +500,6 @@ bool QQmlJSImportVisitor::visit(QQmlJS::AST::UiObjectBinding *uiob)
void QQmlJSImportVisitor::endVisit(QQmlJS::AST::UiObjectBinding *uiob)
{
m_currentScope->resolveTypes(m_rootScopeImports);
- m_currentScope->resolveGroupedScopes();
const QQmlJSScope::ConstPtr childScope = m_currentScope;
leaveEnvironment();