Fixed EnumerateProperties to enumerate properties of the base object.

Done with: ckamm
This commit is contained in:
Roberto Raggi
2010-02-03 11:11:31 +01:00
parent 038b75825d
commit 1cbee8cd71

View File

@@ -143,16 +143,24 @@ public:
_globalCompletion = globalCompletion;
}
QHash<QString, const Interpreter::Value *> operator ()(bool lookAtScope = false)
QHash<QString, const Interpreter::Value *> operator ()(const Interpreter::Value *value)
{
_processed.clear();
_properties.clear();
if (!lookAtScope) {
enumerateProperties(_link->scopeChain().first());
} else {
enumerateProperties(value);
return _properties;
}
QHash<QString, const Interpreter::Value *> operator ()()
{
_processed.clear();
_properties.clear();
foreach (const Interpreter::ObjectValue *scope, _link->scopeChain())
enumerateProperties(scope);
}
return _properties;
}
@@ -650,7 +658,7 @@ int QmlCodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
// It's a global completion.
EnumerateProperties enumerateProperties(&link);
enumerateProperties.setGlobalCompletion(true);
QHashIterator<QString, const Interpreter::Value *> it(enumerateProperties(/* lookAtScope = */ true));
QHashIterator<QString, const Interpreter::Value *> it(enumerateProperties());
while (it.hasNext()) {
it.next();
@@ -679,7 +687,7 @@ int QmlCodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
if (value && completionOperator == QLatin1Char('.')) { // member completion
EnumerateProperties enumerateProperties(&link);
QHashIterator<QString, const Interpreter::Value *> it(enumerateProperties());
QHashIterator<QString, const Interpreter::Value *> it(enumerateProperties(value));
while (it.hasNext()) {
it.next();