ASTJSonconverter stack takes objects and not pointers

This commit is contained in:
Lefteris Karapetsas
2015-01-15 16:56:40 +01:00
parent bcf49095a2
commit 2eaf9ff865
2 changed files with 4 additions and 6 deletions
+3 -5
View File
@@ -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)
+1 -1
View File
@@ -128,7 +128,7 @@ private:
};
Json::Value m_astJson;
std::stack<Json::Value *> m_jsonNodePtrs;
std::stack<Json::Value> m_jsonNodePtrs;
std::string m_source;
ASTNode const* m_ast;
int m_depth;