diff --git a/ASTJsonConverter.cpp b/ASTJsonConverter.cpp index 3ef6728bb..0e40713ac 100644 --- a/ASTJsonConverter.cpp +++ b/ASTJsonConverter.cpp @@ -42,12 +42,12 @@ void ASTJsonConverter::addJsonNode(string const& _typeName, attrs[e.first] = e.second; node["attributes"] = attrs; - m_jsonNodePtrs.top()->append(node); + m_jsonNodePtrs.top().append(node); if (_hasChildren) { Json::Value children(Json::arrayValue); node["children"] = children; - m_jsonNodePtrs.push(&node["children"]); + m_jsonNodePtrs.push(node["children"]); m_depth ++; cout << "goDown" << endl; } @@ -62,9 +62,7 @@ ASTJsonConverter::ASTJsonConverter(ASTNode const& _ast): m_ast(&_ast), m_depth(0 m_astJson["attributes"] = attrs; attrs["name"] = "nameoffile"; //TODO m_astJson["children"] = children; - // m_jsonNodePtrs.push(&m_astJson["children"]); - m_jsonNodePtrs.push(&m_astJson["children"]); - // m_jsonNodePtrs.push(&children); + m_jsonNodePtrs.push(m_astJson["children"]); } void ASTJsonConverter::print(ostream& _stream) diff --git a/ASTJsonConverter.h b/ASTJsonConverter.h index 44bd34617..6db625fed 100644 --- a/ASTJsonConverter.h +++ b/ASTJsonConverter.h @@ -128,7 +128,7 @@ private: }; Json::Value m_astJson; - std::stack m_jsonNodePtrs; + std::stack m_jsonNodePtrs; std::string m_source; ASTNode const* m_ast; int m_depth;