diff options
author | wbt <wbt@users.noreply.github.com> | 2018-01-23 22:44:37 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-23 22:44:37 +0800 |
commit | 761eae2499b172334e5ea3e75573af99fae2a975 (patch) | |
tree | 3ec324015e8d97e9b7ca43cb4dcc3c46b1b3bf31 /libsolidity/analysis/ConstantEvaluator.h | |
parent | 7c69d88f937324b64ed8825f9e611e417421434b (diff) | |
parent | e5def2da3d9b6cffbff42e2c9e1941831d2fe5ea (diff) | |
download | dexon-solidity-761eae2499b172334e5ea3e75573af99fae2a975.tar dexon-solidity-761eae2499b172334e5ea3e75573af99fae2a975.tar.gz dexon-solidity-761eae2499b172334e5ea3e75573af99fae2a975.tar.bz2 dexon-solidity-761eae2499b172334e5ea3e75573af99fae2a975.tar.lz dexon-solidity-761eae2499b172334e5ea3e75573af99fae2a975.tar.xz dexon-solidity-761eae2499b172334e5ea3e75573af99fae2a975.tar.zst dexon-solidity-761eae2499b172334e5ea3e75573af99fae2a975.zip |
Update from official repo
Diffstat (limited to 'libsolidity/analysis/ConstantEvaluator.h')
-rw-r--r-- | libsolidity/analysis/ConstantEvaluator.h | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/libsolidity/analysis/ConstantEvaluator.h b/libsolidity/analysis/ConstantEvaluator.h index 6725d610..77a357b6 100644 --- a/libsolidity/analysis/ConstantEvaluator.h +++ b/libsolidity/analysis/ConstantEvaluator.h @@ -38,22 +38,32 @@ class TypeChecker; class ConstantEvaluator: private ASTConstVisitor { public: - ConstantEvaluator(Expression const& _expr, ErrorReporter& _errorReporter, size_t _newDepth = 0): + ConstantEvaluator( + ErrorReporter& _errorReporter, + size_t _newDepth = 0, + std::shared_ptr<std::map<ASTNode const*, TypePointer>> _types = std::make_shared<std::map<ASTNode const*, TypePointer>>() + ): m_errorReporter(_errorReporter), - m_depth(_newDepth) + m_depth(_newDepth), + m_types(_types) { - _expr.accept(*this); } + TypePointer evaluate(Expression const& _expr); + private: virtual void endVisit(BinaryOperation const& _operation); virtual void endVisit(UnaryOperation const& _operation); virtual void endVisit(Literal const& _literal); virtual void endVisit(Identifier const& _identifier); + void setType(ASTNode const& _node, TypePointer const& _type); + TypePointer type(ASTNode const& _node); + ErrorReporter& m_errorReporter; /// Current recursion depth. - size_t m_depth; + size_t m_depth = 0; + std::shared_ptr<std::map<ASTNode const*, TypePointer>> m_types; }; } |