Document appendFunctionSelector

This commit is contained in:
Alex Beregszaszi 2017-06-28 16:55:20 +01:00 committed by chriseth
parent ef9a7b2144
commit 6a708b0cfe

View File

@ -297,16 +297,20 @@ void ContractCompiler::appendFunctionSelector(ContractDefinition const& _contrac
if (!functionType->isPayable() && !_contract.isLibrary())
appendCallValueCheck();
// Return tag is used to jump out of the function.
eth::AssemblyItem returnTag = m_context.pushNewTag();
// Parameter for calldataUnpacker
m_context << CompilerUtils::dataStartOffset;
appendCalldataUnpacker(functionType->parameterTypes());
m_context.appendJumpTo(m_context.functionEntryLabel(functionType->declaration()));
m_context << returnTag;
// Return tag and input parameters get consumed.
m_context.adjustStackOffset(
CompilerUtils(m_context).sizeOnStack(functionType->returnParameterTypes()) -
CompilerUtils(m_context).sizeOnStack(functionType->parameterTypes()) -
1
);
// Consumes the return parameters.
appendReturnValuePacker(functionType->returnParameterTypes(), _contract.isLibrary());
}
}