mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Implement address(...).code in the IR
This commit is contained in:
committed by
Alex Beregszaszi
parent
7b347b9ec2
commit
baaf7c0db8
@@ -4055,3 +4055,21 @@ string YulUtilFunctions::copyConstructorArgumentsToMemoryFunction(
|
||||
.render();
|
||||
});
|
||||
}
|
||||
|
||||
string YulUtilFunctions::externalCodeFunction()
|
||||
{
|
||||
string functionName = "external_code_at";
|
||||
|
||||
return m_functionCollector.createFunction(functionName, [&]() {
|
||||
return util::Whiskers(R"(
|
||||
function <functionName>(addr) -> mpos {
|
||||
let length := extcodesize(addr)
|
||||
mpos := <allocateArray>(length)
|
||||
extcodecopy(addr, add(mpos, 0x20), 0, length)
|
||||
}
|
||||
)")
|
||||
("functionName", functionName)
|
||||
("allocateArray", allocateMemoryArrayFunction(*TypeProvider::bytesMemory()))
|
||||
.render();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user