Skip to content

Commit 1ad3954

Browse files
committed
libevmasm/Assembly.cpp: minors.
1 parent 8fa368a commit 1ad3954

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

libevmasm/Assembly.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ unsigned Assembly::codeSize(unsigned subTagSize) const
7676

7777
void Assembly::addAssemblyItemsFromJSON(Json::Value const& _code)
7878
{
79+
solAssert(m_items.empty(), "");
7980
solAssert(_code.isArray(), "");
8081
for (auto const& jsonItem: _code)
8182
m_items.emplace_back(loadItemFromJSON(jsonItem));
@@ -106,28 +107,27 @@ AssemblyItem Assembly::loadItemFromJSON(Json::Value const& _json)
106107
std::string jumpType = _json["jumpType"].isString() ? _json["jumpType"].asString() : "";
107108
solAssert(!name.empty(), "");
108109

110+
SourceLocation location;
111+
location.start = begin;
112+
location.end = end;
113+
109114
auto updateUsedTags = [&](u256 const& data) {
110-
auto tag = static_cast<unsigned>(data);
111-
if (m_usedTags <= tag)
112-
m_usedTags = tag + 1;
115+
m_usedTags = max(m_usedTags, static_cast<unsigned>(data) + 1);
113116
return data;
114117
};
115118

116119
auto immutableHash = [&](string const& _immutableName) -> h256 {
117-
h256 hash(util::keccak256(value));
120+
h256 hash(util::keccak256(_immutableName));
118121
m_immutables[hash] = _immutableName;
119122
return hash;
120123
};
121124

122125
auto libraryHash = [&](string const& _libraryName) -> h256 {
123-
h256 hash(util::keccak256(value));
126+
h256 hash(util::keccak256(_libraryName));
124127
m_libraries[hash] = _libraryName;
125128
return hash;
126129
};
127130

128-
SourceLocation location;
129-
location.start = begin;
130-
location.end = end;
131131
if (srcIndex > -1 && srcIndex < static_cast<int>(sources().size()))
132132
location.sourceName = sources()[static_cast<size_t>(srcIndex)];
133133

0 commit comments

Comments
 (0)