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