Skip to content
Snippets Groups Projects
Commit 1cbee8cd authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Fixed EnumerateProperties to enumerate properties of the base object.

Done with: ckamm
parent 038b7582
No related merge requests found
...@@ -143,16 +143,24 @@ public: ...@@ -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) ...@@ -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) ...@@ -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();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment