mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Fix state after CompilerStack.reset()
This commit is contained in:
parent
c212d7c2e6
commit
998ca552b8
libsolidity/interface
@ -85,6 +85,7 @@ void CompilerStack::reset(bool _keepSources)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
m_stackState = Empty;
|
||||||
m_sources.clear();
|
m_sources.clear();
|
||||||
}
|
}
|
||||||
m_optimize = false;
|
m_optimize = false;
|
||||||
@ -94,7 +95,6 @@ void CompilerStack::reset(bool _keepSources)
|
|||||||
m_sourceOrder.clear();
|
m_sourceOrder.clear();
|
||||||
m_contracts.clear();
|
m_contracts.clear();
|
||||||
m_errorReporter.clear();
|
m_errorReporter.clear();
|
||||||
m_stackState = Empty;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CompilerStack::addSource(string const& _name, string const& _content, bool _isLibrary)
|
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;
|
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
|
tuple<int, int, int, int> CompilerStack::positionFromSourceLocation(SourceLocation const& _sourceLocation) const
|
||||||
{
|
{
|
||||||
int startLine;
|
int startLine;
|
||||||
|
@ -259,6 +259,13 @@ private:
|
|||||||
Json::Value const& contractABI(Contract const&) const;
|
Json::Value const& contractABI(Contract const&) const;
|
||||||
Json::Value const& natspec(Contract const&, DocumentationType _type) const;
|
Json::Value const& natspec(Contract const&, DocumentationType _type) const;
|
||||||
|
|
||||||
|
/// @returns the offset of the entry point of the given function into the list of assembly items
|
||||||
|
/// or zero if it is not found or does not exist.
|
||||||
|
size_t functionEntryPoint(
|
||||||
|
std::string const& _contractName,
|
||||||
|
FunctionDefinition const& _function
|
||||||
|
) const;
|
||||||
|
|
||||||
struct Remapping
|
struct Remapping
|
||||||
{
|
{
|
||||||
std::string context;
|
std::string context;
|
||||||
|
Loading…
Reference in New Issue
Block a user