Create children node in ASTJsonConverter when neccesary

This commit is contained in:
Alex Beregszaszi 2017-08-17 02:13:16 +01:00
parent e3f90565d8
commit 4b56829ac3

View File

@ -91,12 +91,20 @@ void ASTJsonConverter::setJsonNode(
)) ))
{ {
if (e.second.isObject()) if (e.second.isObject())
{
if (!m_currentValue["children"].isArray())
m_currentValue["children"] = Json::arrayValue;
appendMove(m_currentValue["children"], std::move(e.second)); appendMove(m_currentValue["children"], std::move(e.second));
}
if (e.second.isArray()) if (e.second.isArray())
for (auto& child: e.second) for (auto& child: e.second)
if (!child.isNull()) if (!child.isNull())
{
if (!m_currentValue["children"].isArray())
m_currentValue["children"] = Json::arrayValue;
appendMove(m_currentValue["children"], std::move(child)); appendMove(m_currentValue["children"], std::move(child));
} }
}
else else
{ {
if (e.first == "typeDescriptions") if (e.first == "typeDescriptions")