aboutsummaryrefslogtreecommitdiffstats
path: root/ASTJsonConverter.h
diff options
context:
space:
mode:
authorLefteris Karapetsas <lefteris@refu.co>2015-01-06 23:50:04 +0800
committerLefteris Karapetsas <lefteris@refu.co>2015-01-15 23:56:40 +0800
commitbcf49095a2f66083f2a198be424daa98ac2e5b72 (patch)
tree982f8fdc236016f9f90abb1f43368cc74b6d3f7d /ASTJsonConverter.h
parentd5b1b4d624ce1ef1f2b7bdb02fd6221acc5762b9 (diff)
downloaddexon-solidity-bcf49095a2f66083f2a198be424daa98ac2e5b72.tar.gz
dexon-solidity-bcf49095a2f66083f2a198be424daa98ac2e5b72.tar.zst
dexon-solidity-bcf49095a2f66083f2a198be424daa98ac2e5b72.zip
More work on the AST export. Work in progress
Diffstat (limited to 'ASTJsonConverter.h')
-rw-r--r--ASTJsonConverter.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/ASTJsonConverter.h b/ASTJsonConverter.h
index 0c84ee9a..44bd3461 100644
--- a/ASTJsonConverter.h
+++ b/ASTJsonConverter.h
@@ -23,7 +23,9 @@
#pragma once
#include <ostream>
+#include <stack>
#include <libsolidity/ASTVisitor.h>
+#include <libsolidity/Exceptions.h>
#include <jsoncpp/json/json.h>
namespace dev
@@ -113,14 +115,23 @@ public:
private:
void addJsonNode(std::string const& _typeName,
- std::initializer_list<std::pair<std::string const, std::string const>> _list);
+ std::initializer_list<std::pair<std::string const, std::string const>> _list,
+ bool _hasChildren);
void printType(Expression const& _expression);
- bool goDeeper() { return true; }
+ inline void goUp()
+ {
+ std::cout << "goUp" << std::endl;
+ m_jsonNodePtrs.pop();
+ m_depth--;
+ if (m_depth < 0)
+ BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Internal error"));
+ };
Json::Value m_astJson;
- Json::Value *m_childrenPtr;
+ std::stack<Json::Value *> m_jsonNodePtrs;
std::string m_source;
ASTNode const* m_ast;
+ int m_depth;
};
}