mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Sol -> Yul: Implement explicit cast
This commit is contained in:
committed by
chriseth
parent
441369d5f1
commit
1ef213cc15
@@ -155,8 +155,31 @@ void IRGeneratorForStatements::endVisit(BinaryOperation const& _binOp)
|
||||
|
||||
bool IRGeneratorForStatements::visit(FunctionCall const& _functionCall)
|
||||
{
|
||||
solUnimplementedAssert(_functionCall.annotation().kind == FunctionCallKind::FunctionCall, "");
|
||||
FunctionTypePointer functionType = dynamic_cast<FunctionType const*>(_functionCall.expression().annotation().type);
|
||||
solUnimplementedAssert(
|
||||
_functionCall.annotation().kind == FunctionCallKind::FunctionCall ||
|
||||
_functionCall.annotation().kind == FunctionCallKind::TypeConversion,
|
||||
"This type of function call is not yet implemented"
|
||||
);
|
||||
|
||||
TypePointer const funcType = _functionCall.expression().annotation().type;
|
||||
|
||||
if (_functionCall.annotation().kind == FunctionCallKind::TypeConversion)
|
||||
{
|
||||
solAssert(funcType->category() == Type::Category::TypeType, "Expected category to be TypeType");
|
||||
solAssert(_functionCall.arguments().size() == 1, "Expected one argument for type conversion");
|
||||
_functionCall.arguments().front()->accept(*this);
|
||||
|
||||
m_code <<
|
||||
"let " <<
|
||||
m_context.variable(_functionCall) <<
|
||||
" := " <<
|
||||
expressionAsType(*_functionCall.arguments().front(), *_functionCall.annotation().type) <<
|
||||
"\n";
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
FunctionTypePointer functionType = dynamic_cast<FunctionType const*>(funcType);
|
||||
|
||||
TypePointers parameterTypes = functionType->parameterTypes();
|
||||
vector<ASTPointer<Expression const>> const& callArguments = _functionCall.arguments();
|
||||
|
||||
Reference in New Issue
Block a user