Skip to content

Commit 24ebfc7

Browse files
committed
Remove yulUtilityFileName
1 parent a1c8adb commit 24ebfc7

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

libevmasm/EVMAssemblyStack.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
#include <liblangutil/Exceptions.h>
2323
#include <libsolidity/codegen/CompilerContext.h>
2424

25+
#include <range/v3/view/enumerate.hpp>
26+
#include <range/v3/view/transform.hpp>
27+
2528
#include <tuple>
2629

2730
using namespace solidity::util;
@@ -73,12 +76,10 @@ LinkerObject const& EVMAssemblyStack::runtimeObject(std::string const& _contract
7376
std::map<std::string, unsigned> EVMAssemblyStack::sourceIndices() const
7477
{
7578
solAssert(m_evmAssembly);
76-
std::map<std::string, unsigned> indices;
77-
unsigned index = 0;
78-
for (auto const& s: m_sourceList)
79-
if (s != CompilerContext::yulUtilityFileName())
80-
indices[s] = index++;
81-
return indices;
79+
return m_sourceList
80+
| ranges::views::enumerate
81+
| ranges::views::transform([](auto const& _source) { return std::make_pair(_source.second, _source.first); })
82+
| ranges::to<std::map<std::string, unsigned>>;
8283
}
8384

8485
std::string const* EVMAssemblyStack::sourceMapping(std::string const& _contractName) const

test/cmdlineTests/asm_json_import_all_valid_flags/output

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333
},
3434
"sourceList":
3535
[
36-
"contract.sol"
36+
"contract.sol",
37+
"#utility.yul"
3738
]
3839
},
3940
"bin": "5ffe",
@@ -84,6 +85,7 @@ EVM assembly:
8485
},
8586
"sourceList":
8687
[
87-
"contract.sol"
88+
"contract.sol",
89+
"#utility.yul"
8890
]
8991
}

0 commit comments

Comments
 (0)