mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
[libsolidity] sourceIndices: selectable internal sources.
This commit is contained in:
parent
ef150b7fa6
commit
8608bc3b8c
@ -978,14 +978,14 @@ Json::Value CompilerStack::assemblyJSON(string const& _contractName) const
|
||||
|
||||
vector<string> CompilerStack::sourceNames() const
|
||||
{
|
||||
map<string, unsigned> indices = sourceIndices();
|
||||
map<string, unsigned> indices = sourceIndices(false);
|
||||
vector<string> names(indices.size());
|
||||
for (auto const& s: indices)
|
||||
names[s.second] = s.first;
|
||||
return names;
|
||||
}
|
||||
|
||||
map<string, unsigned> CompilerStack::sourceIndices() const
|
||||
map<string, unsigned> CompilerStack::sourceIndices(bool _includeInternalSources /* = true */) const
|
||||
{
|
||||
map<string, unsigned> indices;
|
||||
unsigned index = 0;
|
||||
@ -994,7 +994,8 @@ map<string, unsigned> CompilerStack::sourceIndices() const
|
||||
for (auto const& s: m_sources)
|
||||
indices[s.first] = index++;
|
||||
solAssert(!indices.count(CompilerContext::yulUtilityFileName()), "");
|
||||
indices[CompilerContext::yulUtilityFileName()] = index++;
|
||||
if (_includeInternalSources)
|
||||
indices[CompilerContext::yulUtilityFileName()] = index++;
|
||||
}
|
||||
else
|
||||
for (auto const& s: m_sourceOrder)
|
||||
|
@ -242,7 +242,7 @@ public:
|
||||
|
||||
/// @returns a mapping assigning each source name its index inside the vector returned
|
||||
/// by sourceNames().
|
||||
std::map<std::string, unsigned> sourceIndices() const;
|
||||
std::map<std::string, unsigned> sourceIndices(bool _includeInternalSources = true) const;
|
||||
|
||||
/// @returns the previously used character stream, useful for counting lines during error reporting.
|
||||
langutil::CharStream const& charStream(std::string const& _sourceName) const override;
|
||||
|
Loading…
Reference in New Issue
Block a user