Skip to content

Commit e1c8cd3

Browse files
committed
fix treatment of literal value in json im-/export
1 parent 6a2ae27 commit e1c8cd3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

libyul/AsmJsonImporter.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,10 @@ Literal AsmJsonImporter::createLiteral(Json const& _node)
198198
yulAssert(false, "unknown type of literal");
199199

200200
solAssert(member(_node, "hexValue").is_string() || member(_node, "value").is_string(), "");
201-
if (_node.contains("hexValue"))
202-
lit.value = valueOfNumberLiteral(util::asString(util::fromHex(member(_node, "hexValue").get<std::string>())));
201+
if (lit.kind == LiteralKind::String && _node.contains("hexValue"))
202+
lit.value = valueOfStringLiteral(util::asString(util::fromHex(member(_node, "hexValue").get<std::string>())));
203203
else
204-
lit.value = valueOfLiteral(member(_node, "value").get<std::string>(), lit.kind);
204+
lit.value = valueOfNumberLiteral(member(_node, "value").get<std::string>());
205205

206206
lit.type = YulString{member(_node, "type").get<std::string>()};
207207

0 commit comments

Comments
 (0)