aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/interface/CompilerStack.cpp
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-06-01 20:28:32 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-06-01 20:44:08 +0800
commit998ca552b8966d67bbbc7482e972563efade9a80 (patch)
treec45c41ac4eef9838317f0b34bab24394bd9e2f3a /libsolidity/interface/CompilerStack.cpp
parentc212d7c2e6b16063191d85471871eeddf0e6510d (diff)
downloaddexon-solidity-998ca552b8966d67bbbc7482e972563efade9a80.tar.gz
dexon-solidity-998ca552b8966d67bbbc7482e972563efade9a80.tar.zst
dexon-solidity-998ca552b8966d67bbbc7482e972563efade9a80.zip
Fix state after CompilerStack.reset()
Diffstat (limited to 'libsolidity/interface/CompilerStack.cpp')
-rw-r--r--libsolidity/interface/CompilerStack.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp
index c3fcc1ef..aca9ce39 100644
--- a/libsolidity/interface/CompilerStack.cpp
+++ b/libsolidity/interface/CompilerStack.cpp
@@ -85,6 +85,7 @@ void CompilerStack::reset(bool _keepSources)
}
else
{
+ m_stackState = Empty;
m_sources.clear();
}
m_optimize = false;
@@ -94,7 +95,6 @@ void CompilerStack::reset(bool _keepSources)
m_sourceOrder.clear();
m_contracts.clear();
m_errorReporter.clear();
- m_stackState = Empty;
}
bool CompilerStack::addSource(string const& _name, string const& _content, bool _isLibrary)
@@ -513,6 +513,24 @@ ContractDefinition const& CompilerStack::contractDefinition(string const& _contr
return *contract(_contractName).contract;
}
+size_t CompilerStack::functionEntryPoint(
+ std::string const& _contractName,
+ FunctionDefinition const& _function
+) const
+{
+ shared_ptr<Compiler> const& compiler = contract(_contractName).compiler;
+ if (!compiler)
+ return 0;
+ eth::AssemblyItem tag = compiler->functionEntryLabel(_function);
+ if (tag.type() == eth::UndefinedItem)
+ return 0;
+ eth::AssemblyItems const& items = compiler->runtimeAssemblyItems();
+ for (size_t i = 0; i < items.size(); ++i)
+ if (items.at(i).type() == eth::Tag && items.at(i).data() == tag.data())
+ return i;
+ return 0;
+}
+
tuple<int, int, int, int> CompilerStack::positionFromSourceLocation(SourceLocation const& _sourceLocation) const
{
int startLine;