Fix accessing constants at file level from inline assembly.

This commit is contained in:
chriseth 2021-01-14 10:51:33 +01:00
parent fe344ed6e5
commit 30305ebbd9
2 changed files with 6 additions and 8 deletions

View File

@ -111,19 +111,15 @@ private:
solUnimplementedAssert(varDecl, "");
string const& suffix = reference.suffix;
if (suffix.empty() && !varDecl->isStateVariable())
string value;
if (suffix.empty() && varDecl->isLocalVariable())
{
auto const& var = m_context.localVariable(*varDecl);
solAssert(var.type().sizeOnStack() == 1, "");
return yul::Identifier{
_identifier.location,
yul::YulString{var.commaSeparatedList()}
};
value = var.commaSeparatedList();
}
string value;
if (varDecl->isConstant())
else if (varDecl->isConstant())
{
VariableDeclaration const* variable = rootConstVariableDeclaration(*varDecl);
solAssert(variable, "");

View File

@ -5,5 +5,7 @@ contract C {
assembly { z := e }
}
}
// ====
// compileViaYul: also
// ----
// f() -> 0x1212121212121212121212121000002134593163