mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Fix accessing constants at file level from inline assembly.
This commit is contained in:
parent
fe344ed6e5
commit
30305ebbd9
@ -111,19 +111,15 @@ private:
|
|||||||
solUnimplementedAssert(varDecl, "");
|
solUnimplementedAssert(varDecl, "");
|
||||||
string const& suffix = reference.suffix;
|
string const& suffix = reference.suffix;
|
||||||
|
|
||||||
if (suffix.empty() && !varDecl->isStateVariable())
|
string value;
|
||||||
|
if (suffix.empty() && varDecl->isLocalVariable())
|
||||||
{
|
{
|
||||||
auto const& var = m_context.localVariable(*varDecl);
|
auto const& var = m_context.localVariable(*varDecl);
|
||||||
solAssert(var.type().sizeOnStack() == 1, "");
|
solAssert(var.type().sizeOnStack() == 1, "");
|
||||||
|
|
||||||
return yul::Identifier{
|
value = var.commaSeparatedList();
|
||||||
_identifier.location,
|
|
||||||
yul::YulString{var.commaSeparatedList()}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
else if (varDecl->isConstant())
|
||||||
string value;
|
|
||||||
if (varDecl->isConstant())
|
|
||||||
{
|
{
|
||||||
VariableDeclaration const* variable = rootConstVariableDeclaration(*varDecl);
|
VariableDeclaration const* variable = rootConstVariableDeclaration(*varDecl);
|
||||||
solAssert(variable, "");
|
solAssert(variable, "");
|
||||||
|
@ -5,5 +5,7 @@ contract C {
|
|||||||
assembly { z := e }
|
assembly { z := e }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// ====
|
||||||
|
// compileViaYul: also
|
||||||
// ----
|
// ----
|
||||||
// f() -> 0x1212121212121212121212121000002134593163
|
// f() -> 0x1212121212121212121212121000002134593163
|
||||||
|
Loading…
Reference in New Issue
Block a user