summaryrefslogtreecommitdiff
path: root/src/plugins/qmljseditor
diff options
context:
space:
mode:
authorChristian Kamm <christian.d.kamm@nokia.com>2010-11-17 14:20:06 +0100
committerChristian Kamm <christian.d.kamm@nokia.com>2010-11-17 14:50:13 +0100
commitaa2d9e6dd66344cc9433ea8225a83ab64e340494 (patch)
tree16c50ef85a17546a31c49b21d5a056f3a5a0bec7 /src/plugins/qmljseditor
parent4d5cdb3ed88a1a016e5a19a5be2060c44c0ff697 (diff)
downloadqt-creator-aa2d9e6dd66344cc9433ea8225a83ab64e340494.tar.gz
QmlJS: Return owning object from lookupMember.
Diffstat (limited to 'src/plugins/qmljseditor')
-rw-r--r--src/plugins/qmljseditor/qmljsfindreferences.cpp25
1 files changed, 4 insertions, 21 deletions
diff --git a/src/plugins/qmljseditor/qmljsfindreferences.cpp b/src/plugins/qmljseditor/qmljsfindreferences.cpp
index d17158ba23..9771ea5280 100644
--- a/src/plugins/qmljseditor/qmljsfindreferences.cpp
+++ b/src/plugins/qmljseditor/qmljsfindreferences.cpp
@@ -64,25 +64,6 @@ using namespace QmlJS::Interpreter;
using namespace QmlJS::AST;
using namespace QmlJSEditor;
-static const ObjectValue *prototypeWithMember(const Context *context, const ObjectValue *object, const QString &name)
-{
- if (!object)
- return 0;
- const Value *value = object->property(name, context);
- if (!value)
- return 0;
- const ObjectValue *prev = object;
- PrototypeIterator iter(object, context);
- iter.next();
- while (iter.hasNext()) {
- const ObjectValue *prototype = iter.next();
- if (prototype->property(name, context) != value)
- return prev;
- prev = prototype;
- }
- return prev;
-}
-
namespace {
// ### These visitors could be useful in general
@@ -265,7 +246,9 @@ private:
{
if (!s)
return false;
- return prototypeWithMember(_context, s, _name) == _scope;
+ const ObjectValue *definingObject;
+ s->lookupMember(_name, _context, &definingObject);
+ return definingObject == _scope;
}
bool checkQmlScope()
@@ -610,7 +593,7 @@ static void find_helper(QFutureInterface<FindReferences::Usage> &future,
}
if (!scope)
return;
- scope = prototypeWithMember(&context, scope, name);
+ scope->lookupMember(name, &context, &scope);
if (!scope)
return;