mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Yul: Adds parsing @src comment in AsmParser to customize the AST's sourcer locations.
This commit is contained in:
@@ -80,7 +80,6 @@
|
||||
|
||||
#include <utility>
|
||||
#include <map>
|
||||
#include <range/v3/view/concat.hpp>
|
||||
|
||||
#include <boost/algorithm/string/replace.hpp>
|
||||
|
||||
@@ -927,6 +926,19 @@ map<string, unsigned> CompilerStack::sourceIndices() const
|
||||
return indices;
|
||||
}
|
||||
|
||||
map<unsigned, shared_ptr<CharStream>> CompilerStack::indicesToCharStreams() const
|
||||
{
|
||||
map<unsigned, shared_ptr<CharStream>> result;
|
||||
unsigned index = 0;
|
||||
for (auto const& s: m_sources)
|
||||
result[index++] = s.second.scanner->charStream();
|
||||
|
||||
// NB: CompilerContext::yulUtilityFileName() does not have a source,
|
||||
result[index++] = shared_ptr<CharStream>{};
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Json::Value const& CompilerStack::contractABI(string const& _contractName) const
|
||||
{
|
||||
if (m_stackState < AnalysisPerformed)
|
||||
|
||||
@@ -239,6 +239,10 @@ public:
|
||||
/// by sourceNames().
|
||||
std::map<std::string, unsigned> sourceIndices() const;
|
||||
|
||||
/// @returns the reverse mapping of source indices to their respective
|
||||
/// CharStream instances.
|
||||
std::map<unsigned, std::shared_ptr<langutil::CharStream>> indicesToCharStreams() const;
|
||||
|
||||
/// @returns the previously used scanner, useful for counting lines during error reporting.
|
||||
langutil::Scanner const& scanner(std::string const& _sourceName) const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user