Merge pull request #12016 from ethereum/external-fp-10358

Add ``.address`` and ``.selector`` in inside assembly for external function pointers
This commit is contained in:
chriseth
2021-10-05 14:48:58 +02:00
committed by GitHub
16 changed files with 211 additions and 5 deletions
@@ -188,6 +188,18 @@ private:
solAssert(suffix == "offset" || suffix == "length", "");
value = IRVariable{*varDecl}.part(suffix).name();
}
else if (
auto const* functionType = dynamic_cast<FunctionType const*>(varDecl->type());
functionType && functionType->kind() == FunctionType::Kind::External
)
{
solAssert(suffix == "selector" || suffix == "address", "");
solAssert(varDecl->type()->sizeOnStack() == 2, "");
if (suffix == "selector")
value = IRVariable{*varDecl}.part("functionSelector").name();
else
value = IRVariable{*varDecl}.part("address").name();
}
else
solAssert(false, "");