diff options
author | chriseth <c@ethdev.com> | 2015-05-20 06:27:07 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-05-20 06:28:15 +0800 |
commit | 2be64c702609df67903fd89c42cf632d71aad6fd (patch) | |
tree | ceb573ff287d81f47d75acbf8481eab631aa8081 /CompilerStack.cpp | |
parent | 70d9eb3f1d1e16757c8f9b66669cd0f38d7bfef7 (diff) | |
download | dexon-solidity-2be64c702609df67903fd89c42cf632d71aad6fd.tar dexon-solidity-2be64c702609df67903fd89c42cf632d71aad6fd.tar.gz dexon-solidity-2be64c702609df67903fd89c42cf632d71aad6fd.tar.bz2 dexon-solidity-2be64c702609df67903fd89c42cf632d71aad6fd.tar.lz dexon-solidity-2be64c702609df67903fd89c42cf632d71aad6fd.tar.xz dexon-solidity-2be64c702609df67903fd89c42cf632d71aad6fd.tar.zst dexon-solidity-2be64c702609df67903fd89c42cf632d71aad6fd.zip |
Gas estimation taking known state into account.
Diffstat (limited to 'CompilerStack.cpp')
-rw-r--r-- | CompilerStack.cpp | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/CompilerStack.cpp b/CompilerStack.cpp index bffa4158..4f976407 100644 --- a/CompilerStack.cpp +++ b/CompilerStack.cpp @@ -55,12 +55,29 @@ const map<string, string> StandardSources = map<string, string>{ }; CompilerStack::CompilerStack(bool _addStandardSources): - m_addStandardSources(_addStandardSources), m_parseSuccessful(false) + m_parseSuccessful(false) { - if (m_addStandardSources) + if (_addStandardSources) addSources(StandardSources, true); // add them as libraries } +void CompilerStack::reset(bool _keepSources, bool _addStandardSources) +{ + m_parseSuccessful = false; + if (_keepSources) + for (auto sourcePair: m_sources) + sourcePair.second.reset(); + else + { + m_sources.clear(); + if (_addStandardSources) + addSources(StandardSources, true); + } + m_globalContext.reset(); + m_sourceOrder.clear(); + m_contracts.clear(); +} + bool CompilerStack::addSource(string const& _name, string const& _content, bool _isLibrary) { bool existed = m_sources.count(_name) != 0; @@ -269,23 +286,6 @@ tuple<int, int, int, int> CompilerStack::positionFromSourceLocation(SourceLocati return make_tuple(++startLine, ++startColumn, ++endLine, ++endColumn); } -void CompilerStack::reset(bool _keepSources) -{ - m_parseSuccessful = false; - if (_keepSources) - for (auto sourcePair: m_sources) - sourcePair.second.reset(); - else - { - m_sources.clear(); - if (m_addStandardSources) - addSources(StandardSources, true); - } - m_globalContext.reset(); - m_sourceOrder.clear(); - m_contracts.clear(); -} - void CompilerStack::resolveImports() { // topological sorting (depth first search) of the import graph, cutting potential cycles |