aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2016-08-29 10:13:34 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2016-10-28 08:05:55 +0000
commit738ed8e5c0de334d780659bbef8a360154a87221 (patch)
tree88f4593d41d906e93ad41d0da78aba5552c8f126
parent9260c1ccbe40f67e92204d35f781cd4167084753 (diff)
Fix the value of "original" for list properties
It has to be the empty array in that case, as otherwise the value from the module prototype will get duplicated. Change-Id: I444342ce106fc6b9e302c0df18716906e926e966 Reviewed-by: Jake Petroules <jake.petroules@qt.io>
-rw-r--r--src/lib/corelib/language/evaluatorscriptclass.cpp16
-rw-r--r--src/lib/corelib/language/tst_language.cpp7
2 files changed, 13 insertions, 10 deletions
diff --git a/src/lib/corelib/language/evaluatorscriptclass.cpp b/src/lib/corelib/language/evaluatorscriptclass.cpp
index 90bc8c49a..739edb9d0 100644
--- a/src/lib/corelib/language/evaluatorscriptclass.cpp
+++ b/src/lib/corelib/language/evaluatorscriptclass.cpp
@@ -231,13 +231,17 @@ private:
setupConvenienceProperty(QLatin1String("outer"), &extraScope, v);
}
if (value->sourceUsesOriginal()) {
- const Item *item = itemOfProperty;
- while (item->type() == ItemType::ModuleInstance)
- item = item->prototype();
QScriptValue originalValue;
- SVConverter converter(scriptClass, object, item->property(*propertyName), item,
- propertyName, data, &originalValue, sourceValueStack);
- converter.start();
+ if (data->item->propertyDeclaration(propertyName->toString()).isScalar()) {
+ const Item *item = itemOfProperty;
+ while (item->type() == ItemType::ModuleInstance)
+ item = item->prototype();
+ SVConverter converter(scriptClass, object, item->property(*propertyName), item,
+ propertyName, data, &originalValue, sourceValueStack);
+ converter.start();
+ } else {
+ originalValue = engine->newArray(0);
+ }
setupConvenienceProperty(QLatin1String("original"), &extraScope, originalValue);
}
diff --git a/src/lib/corelib/language/tst_language.cpp b/src/lib/corelib/language/tst_language.cpp
index 166a3f48f..82ca99194 100644
--- a/src/lib/corelib/language/tst_language.cpp
+++ b/src/lib/corelib/language/tst_language.cpp
@@ -413,7 +413,6 @@ void TestLanguage::defaultValue()
propertyName = QStringList() << "modules" << "lower" << "listProp";
propertyValue = getConfigProperty(product->moduleProperties->value(), propertyName);
QFETCH(QVariant, expectedListPropValue);
- QEXPECT_FAIL("controlling property not overwritten", "QBS-845", Continue);
QCOMPARE(propertyValue.toStringList(), expectedListPropValue.toStringList());
}
catch (const ErrorInfo &e) {
@@ -429,13 +428,13 @@ void TestLanguage::defaultValue_data()
QTest::addColumn<QVariant>("expectedProp2Value");
QTest::addColumn<QVariant>("expectedListPropValue");
QTest::newRow("controlling property with random value") << "random" << QVariant("withoutBlubb")
- << QVariant(QStringList({"other", "other"}));
+ << QVariant(QStringList({"other"}));
QTest::newRow("controlling property with blubb value") << "blubb" << QVariant("withBlubb")
- << QVariant(QStringList({"blubb", "other", "blubb", "other"}));
+ << QVariant(QStringList({"blubb", "other"}));
QTest::newRow("controlling property with egon value") << "egon" << QVariant("withEgon")
<< QVariant(QStringList({"egon", "other"}));
QTest::newRow("controlling property not overwritten") << "" << QVariant("withBlubb")
- << QVariant(QStringList({"blubb", "other", "blubb", "other"}));
+ << QVariant(QStringList({"blubb", "other"}));
}
void TestLanguage::environmentVariable()