diff options
author | chriseth <c@ethdev.com> | 2015-11-24 06:57:17 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-11-26 22:37:55 +0800 |
commit | b47d5932528357939ee29758a8b8027c90bdb1e5 (patch) | |
tree | a32526db014b5a654e193660e883e97ab437aa95 /libsolidity/formal/Why3Translator.cpp | |
parent | 86495dfc57dde9b825ffd8c219ea809446e978f9 (diff) | |
download | dexon-solidity-b47d5932528357939ee29758a8b8027c90bdb1e5.tar.gz dexon-solidity-b47d5932528357939ee29758a8b8027c90bdb1e5.tar.zst dexon-solidity-b47d5932528357939ee29758a8b8027c90bdb1e5.zip |
Do not store elements of a contract by AST node type.
Diffstat (limited to 'libsolidity/formal/Why3Translator.cpp')
-rw-r--r-- | libsolidity/formal/Why3Translator.cpp | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/libsolidity/formal/Why3Translator.cpp b/libsolidity/formal/Why3Translator.cpp index fe3729d4..5028e2c3 100644 --- a/libsolidity/formal/Why3Translator.cpp +++ b/libsolidity/formal/Why3Translator.cpp @@ -145,8 +145,8 @@ bool Why3Translator::visit(ContractDefinition const& _contract) addLine("type state = {"); indent(); - m_stateVariables = &_contract.stateVariables(); - for (auto const& variable: _contract.stateVariables()) + m_stateVariables = _contract.stateVariables(); + for (VariableDeclaration const* variable: m_stateVariables) { string varType = toFormalType(*variable->annotation().type); if (varType.empty()) @@ -174,7 +174,7 @@ bool Why3Translator::visit(ContractDefinition const& _contract) void Why3Translator::endVisit(ContractDefinition const& _contract) { - m_stateVariables = nullptr; + m_stateVariables.clear(); addSourceFromDocStrings(_contract.annotation()); unindent(); addLine("end"); @@ -600,17 +600,12 @@ bool Why3Translator::visit(Literal const& _literal) bool Why3Translator::isStateVariable(VariableDeclaration const* _var) const { - solAssert(!!m_stateVariables, ""); - for (auto const& var: *m_stateVariables) - if (var.get() == _var) - return true; - return false; + return contains(m_stateVariables, _var); } bool Why3Translator::isStateVariable(string const& _name) const { - solAssert(!!m_stateVariables, ""); - for (auto const& var: *m_stateVariables) + for (auto const& var: m_stateVariables) if (var->name() == _name) return true; return false; |