mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Rename external function slot to selector.
This commit is contained in:
parent
ba4e05c62c
commit
147a80aa24
@ -3241,7 +3241,7 @@ vector<tuple<string, TypePointer>> FunctionType::makeStackItems() const
|
|||||||
case Kind::DelegateCall:
|
case Kind::DelegateCall:
|
||||||
slots = {
|
slots = {
|
||||||
make_tuple("address", TypeProvider::address()),
|
make_tuple("address", TypeProvider::address()),
|
||||||
make_tuple("functionIdentifier", TypeProvider::uint(32))
|
make_tuple("functionSelector", TypeProvider::uint(32))
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
case Kind::BareCall:
|
case Kind::BareCall:
|
||||||
|
@ -1395,7 +1395,7 @@ void IRGeneratorForStatements::endVisit(MemberAccess const& _memberAccess)
|
|||||||
solAssert(false, "Contract member is neither variable nor function.");
|
solAssert(false, "Contract member is neither variable nor function.");
|
||||||
|
|
||||||
define(IRVariable(_memberAccess).part("address"), _memberAccess.expression());
|
define(IRVariable(_memberAccess).part("address"), _memberAccess.expression());
|
||||||
define(IRVariable(_memberAccess).part("functionIdentifier")) << formatNumber(identifier) << "\n";
|
define(IRVariable(_memberAccess).part("functionSelector")) << formatNumber(identifier) << "\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
solAssert(false, "Invalid member access in contract");
|
solAssert(false, "Invalid member access in contract");
|
||||||
@ -1431,7 +1431,7 @@ void IRGeneratorForStatements::endVisit(MemberAccess const& _memberAccess)
|
|||||||
*_memberAccess.expression().annotation().type
|
*_memberAccess.expression().annotation().type
|
||||||
);
|
);
|
||||||
if (functionType.kind() == FunctionType::Kind::External)
|
if (functionType.kind() == FunctionType::Kind::External)
|
||||||
define(IRVariable{_memberAccess}, IRVariable(_memberAccess.expression()).part("functionIdentifier"));
|
define(IRVariable{_memberAccess}, IRVariable(_memberAccess.expression()).part("functionSelector"));
|
||||||
else if (functionType.kind() == FunctionType::Kind::Declaration)
|
else if (functionType.kind() == FunctionType::Kind::Declaration)
|
||||||
{
|
{
|
||||||
solAssert(functionType.hasDeclaration(), "");
|
solAssert(functionType.hasDeclaration(), "");
|
||||||
@ -1683,7 +1683,7 @@ void IRGeneratorForStatements::endVisit(MemberAccess const& _memberAccess)
|
|||||||
break;
|
break;
|
||||||
case FunctionType::Kind::DelegateCall:
|
case FunctionType::Kind::DelegateCall:
|
||||||
define(IRVariable(_memberAccess).part("address"), _memberAccess.expression());
|
define(IRVariable(_memberAccess).part("address"), _memberAccess.expression());
|
||||||
define(IRVariable(_memberAccess).part("functionIdentifier")) << formatNumber(memberFunctionType->externalIdentifier()) << "\n";
|
define(IRVariable(_memberAccess).part("functionSelector")) << formatNumber(memberFunctionType->externalIdentifier()) << "\n";
|
||||||
break;
|
break;
|
||||||
case FunctionType::Kind::External:
|
case FunctionType::Kind::External:
|
||||||
case FunctionType::Kind::Creation:
|
case FunctionType::Kind::Creation:
|
||||||
@ -2077,7 +2077,7 @@ void IRGeneratorForStatements::appendExternalFunctionCall(
|
|||||||
|
|
||||||
// storage for arguments and returned data
|
// storage for arguments and returned data
|
||||||
let <pos> := <freeMemory>
|
let <pos> := <freeMemory>
|
||||||
mstore(<pos>, <shl28>(<funId>))
|
mstore(<pos>, <shl28>(<funSel>))
|
||||||
let <end> := <encodeArgs>(add(<pos>, 4) <argumentString>)
|
let <end> := <encodeArgs>(add(<pos>, 4) <argumentString>)
|
||||||
|
|
||||||
let <success> := <call>(<gas>, <address>, <?hasValue> <value>, </hasValue> <pos>, sub(<end>, <pos>), <pos>, <reservedReturnSize>)
|
let <success> := <call>(<gas>, <address>, <?hasValue> <value>, </hasValue> <pos>, sub(<end>, <pos>), <pos>, <reservedReturnSize>)
|
||||||
@ -2107,7 +2107,7 @@ void IRGeneratorForStatements::appendExternalFunctionCall(
|
|||||||
templ("freeMemory", freeMemory());
|
templ("freeMemory", freeMemory());
|
||||||
templ("shl28", m_utils.shiftLeftFunction(8 * (32 - 4)));
|
templ("shl28", m_utils.shiftLeftFunction(8 * (32 - 4)));
|
||||||
|
|
||||||
templ("funId", IRVariable(_functionCall.expression()).part("functionIdentifier").name());
|
templ("funSel", IRVariable(_functionCall.expression()).part("functionSelector").name());
|
||||||
templ("address", IRVariable(_functionCall.expression()).part("address").name());
|
templ("address", IRVariable(_functionCall.expression()).part("address").name());
|
||||||
|
|
||||||
// Always use the actual return length, and not our calculated expected length, if returndatacopy is supported.
|
// Always use the actual return length, and not our calculated expected length, if returndatacopy is supported.
|
||||||
|
Loading…
Reference in New Issue
Block a user