diff --git a/src/libs/qmljs/qmljsinterpreter.cpp b/src/libs/qmljs/qmljsinterpreter.cpp index eedcf519e8bf309e505aa961aa7fed2e9c05e318..ddf0ed993bceb3ff59731672c4563b2f92f042c1 100644 --- a/src/libs/qmljs/qmljsinterpreter.cpp +++ b/src/libs/qmljs/qmljsinterpreter.cpp @@ -1370,10 +1370,10 @@ void ScopeChain::QmlComponentChain::clear() document = Document::Ptr(0); } -void ScopeChain::QmlComponentChain::add(QList<const ObjectValue *> *list) const +void ScopeChain::QmlComponentChain::collect(QList<const ObjectValue *> *list) const { - foreach (QmlComponentChain *parent, instantiatingComponents) - parent->add(list); + foreach (const QmlComponentChain *parent, instantiatingComponents) + parent->collect(list); if (!document) return; @@ -1393,8 +1393,8 @@ void ScopeChain::update() // the root scope in js files doesn't see instantiating components if (jsScopes.count() != 1 || !qmlScopeObjects.isEmpty()) { if (qmlComponentScope) { - foreach (QmlComponentChain *parent, qmlComponentScope->instantiatingComponents) - parent->add(&_all); + foreach (const QmlComponentChain *parent, qmlComponentScope->instantiatingComponents) + parent->collect(&_all); } } diff --git a/src/libs/qmljs/qmljsinterpreter.h b/src/libs/qmljs/qmljsinterpreter.h index 67222cd3b024075fba21c1437605f39a172c64b6..208ed034e00ad0cd0574feffc0f39cf8506e1dd3 100644 --- a/src/libs/qmljs/qmljsinterpreter.h +++ b/src/libs/qmljs/qmljsinterpreter.h @@ -249,15 +249,15 @@ public: QmlComponentChain(); ~QmlComponentChain(); - QList<QmlComponentChain *> instantiatingComponents; + QList<const QmlComponentChain *> instantiatingComponents; Document::Ptr document; - void add(QList<const ObjectValue *> *list) const; + void collect(QList<const ObjectValue *> *list) const; void clear(); }; const ObjectValue *globalScope; - QSharedPointer<QmlComponentChain> qmlComponentScope; + QSharedPointer<const QmlComponentChain> qmlComponentScope; QList<const ObjectValue *> qmlScopeObjects; const ObjectValue *qmlTypes; QList<const ObjectValue *> jsScopes; diff --git a/src/libs/qmljs/qmljslink.cpp b/src/libs/qmljs/qmljslink.cpp index ffc8edf3804214aec693644ad82e54f98e7a52f5..71ed751a9e3b2a2455ab79c2cbb8545bd4d6e076 100644 --- a/src/libs/qmljs/qmljslink.cpp +++ b/src/libs/qmljs/qmljslink.cpp @@ -83,10 +83,11 @@ void Link::initializeScopeChain() Bind *bind = _doc->bind(); QHash<Document *, ScopeChain::QmlComponentChain *> componentScopes; - scopeChain.qmlComponentScope = QSharedPointer<ScopeChain::QmlComponentChain>(new ScopeChain::QmlComponentChain()); + ScopeChain::QmlComponentChain *chain = new ScopeChain::QmlComponentChain; + scopeChain.qmlComponentScope = QSharedPointer<const ScopeChain::QmlComponentChain>(chain); if (_doc->qmlProgram()) { - componentScopes.insert(_doc.data(), scopeChain.qmlComponentScope.data()); - makeComponentChain(_doc, scopeChain.qmlComponentScope.data(), &componentScopes); + componentScopes.insert(_doc.data(), chain); + makeComponentChain(_doc, chain, &componentScopes); if (const ObjectValue *typeEnvironment = _context->typeEnvironment(_doc.data())) scopeChain.qmlTypes = typeEnvironment; @@ -97,7 +98,7 @@ void Link::initializeScopeChain() if (_doc->fileName() == fileImport.name) { ScopeChain::QmlComponentChain *component = new ScopeChain::QmlComponentChain; componentScopes.insert(otherDoc.data(), component); - scopeChain.qmlComponentScope->instantiatingComponents += component; + chain->instantiatingComponents += component; makeComponentChain(otherDoc, component, &componentScopes); } }