Xlist integrated in another Xlist need to be copied to perform an affectation 70/16470/3
Sylvain GENIN [Tue, 12 May 2015 13:45:47 +0000 (15:45 +0200)]
example :
 value = mlist(["test", "NAMES", "VALUES", "DATE"], ...
    "a", ...
    ones(2,2), ...
    ones(2,2));

    data=tlist(["test", "DATA", "PT"], ones(4,1), value);

    test = data;
    data.PT.NAMES = "b" ;
    data.PT.NAMES
    test.PT.NAMES

Change-Id: Ia7c7b1bf1f5747f73300808a1833333ccc1f1b60

scilab/modules/ast/src/cpp/types/list.cpp

index 909ad57..a0ac52a 100644 (file)
@@ -98,7 +98,14 @@ int List::getSize()
 */
 void List::append(InternalType *_typedValue)
 {
-    m_plData->push_back(_typedValue);
+    if (_typedValue->isList())
+    {
+        m_plData->push_back(_typedValue->clone());
+    }
+    else
+    {
+        m_plData->push_back(_typedValue);
+    }
     m_plData->back()->IncreaseRef();
     m_iSize = static_cast<int>(m_plData->size());
 }