diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2017-06-09 13:50:15 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2017-06-09 13:51:34 +0200 |
commit | 7343f24c774af89e7ddf9cf24c3932c703b5937c (patch) | |
tree | 5d29be927aa90fbb25d95007a475a6110d5e855a /src/lib/corelib/language/evaluatorscriptclass.cpp | |
parent | 525165a38302cf43a908a93f57a3a88cd6abc0e0 (diff) | |
parent | 7ccc08f33153cd3093081567ac653e371759d69a (diff) |
Merge 1.8 into master
Change-Id: I2fcb2113a24c8807467aa03aa3e7590d53761706
Diffstat (limited to 'src/lib/corelib/language/evaluatorscriptclass.cpp')
-rwxr-xr-x | src/lib/corelib/language/evaluatorscriptclass.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/lib/corelib/language/evaluatorscriptclass.cpp b/src/lib/corelib/language/evaluatorscriptclass.cpp index 5d96be561..ba7df02b5 100755 --- a/src/lib/corelib/language/evaluatorscriptclass.cpp +++ b/src/lib/corelib/language/evaluatorscriptclass.cpp @@ -270,7 +270,7 @@ private: = data->evaluator->fileContextScopes(value->file()); pushScope(fileCtxScopes.fileScope); pushItemScopes(data->item); - if (itemOfProperty && itemOfProperty->type() != ItemType::ModuleInstance) { + if (itemOfProperty->type() != ItemType::ModuleInstance) { // Own properties of module instances must not have the instance itself in the scope. pushScope(*object); } @@ -369,6 +369,7 @@ QScriptClass::QueryFlags EvaluatorScriptClass::queryItemProperty(const Evaluatio parentdata.item = data->item->parent(); const QueryFlags qf = queryItemProperty(&parentdata, name, true); if (qf.testFlag(HandlesReadAccess)) { + m_queryResult.foundInParent = true; m_queryResult.data = data; return qf; } @@ -566,8 +567,10 @@ private: QScriptValue EvaluatorScriptClass::property(const QScriptValue &object, const QScriptString &name, uint id) { + const bool foundInParent = m_queryResult.foundInParent; const EvaluationData *data = m_queryResult.data; const Item * const itemOfProperty = m_queryResult.itemOfProperty; + m_queryResult.foundInParent = false; m_queryResult.data = 0; m_queryResult.itemOfProperty = 0; QBS_ASSERT(data, return QScriptValue()); @@ -603,7 +606,11 @@ QScriptValue EvaluatorScriptClass::property(const QScriptValue &object, const QS if (value->next() && !m_currentNextChain.contains(value.get())) { collectValuesFromNextChain(data, &result, name.toString(), value); } else { - SVConverter converter(this, &object, value, itemOfProperty, &name, data, &result); + QScriptValue parentObject; + if (foundInParent) + parentObject = data->evaluator->scriptValue(data->item->parent()); + SVConverter converter(this, foundInParent ? &parentObject : &object, value, itemOfProperty, + &name, data, &result); converter.start(); const PropertyDeclaration decl = data->item->propertyDeclaration(name.toString()); |