summaryrefslogtreecommitdiff
path: root/src/libs/qmljs/qmljsscopebuilder.cpp
diff options
context:
space:
mode:
authorChristian Kamm <christian.d.kamm@nokia.com>2010-05-19 11:15:57 +0200
committerChristian Kamm <christian.d.kamm@nokia.com>2010-05-19 11:15:57 +0200
commit088bdb29db87571963e0fab6ff98a6f023c55f0e (patch)
tree0068aebbf50dcc68ea71a038590206c69bce242c /src/libs/qmljs/qmljsscopebuilder.cpp
parent735f908382e9ee3582c8dccc386f22589cd9af83 (diff)
downloadqt-creator-088bdb29db87571963e0fab6ff98a6f023c55f0e.tar.gz
QmlJS: Provide good completion for PropertyChanges with a target again.
Task-number: QTCREATORBUG-1413 Reviewed-by: Erik Verbruggen
Diffstat (limited to 'src/libs/qmljs/qmljsscopebuilder.cpp')
-rw-r--r--src/libs/qmljs/qmljsscopebuilder.cpp25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/libs/qmljs/qmljsscopebuilder.cpp b/src/libs/qmljs/qmljsscopebuilder.cpp
index 7a3bcfd86a..80b3fbb7d7 100644
--- a/src/libs/qmljs/qmljsscopebuilder.cpp
+++ b/src/libs/qmljs/qmljsscopebuilder.cpp
@@ -106,14 +106,7 @@ void ScopeBuilder::setQmlScopeObject(Node *node)
// check if the object has a Qt.PropertyChanges ancestor
prototype = scopeObject->prototype(_context);
- while (prototype) {
- if (const QmlObjectValue *qmlMetaObject = dynamic_cast<const QmlObjectValue *>(prototype)) {
- if (qmlMetaObject->className() == QLatin1String("PropertyChanges")
- && qmlMetaObject->packageName() == QLatin1String("Qt"))
- break;
- }
- prototype = prototype->prototype(_context);
- }
+ prototype = isPropertyChangesObject(_context, prototype);
// find the target script binding
if (prototype) {
UiObjectInitializer *initializer = 0;
@@ -169,3 +162,19 @@ const Value *ScopeBuilder::scopeObjectLookup(AST::UiQualifiedId *id)
return result;
}
+
+
+const ObjectValue *ScopeBuilder::isPropertyChangesObject(Context *context,
+ const ObjectValue *object)
+{
+ const ObjectValue *prototype = object;
+ while (prototype) {
+ if (const QmlObjectValue *qmlMetaObject = dynamic_cast<const QmlObjectValue *>(prototype)) {
+ if (qmlMetaObject->className() == QLatin1String("PropertyChanges")
+ && qmlMetaObject->packageName() == QLatin1String("Qt"))
+ return prototype;
+ }
+ prototype = prototype->prototype(context);
+ }
+ return 0;
+}