mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #8771 from ethereum/sol_yul_selfdestruct
[Sol - Yul] Add support for built-in selfdestruct(..).
This commit is contained in:
commit
ed6c6b3170
@ -812,6 +812,12 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall)
|
|||||||
define(_functionCall) << "gas()\n";
|
define(_functionCall) << "gas()\n";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case FunctionType::Kind::Selfdestruct:
|
||||||
|
{
|
||||||
|
solAssert(arguments.size() == 1, "");
|
||||||
|
define(_functionCall) << "selfdestruct(" << expressionAsType(*arguments.front(), *parameterTypes.front()) << ")\n";
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
solUnimplemented("FunctionKind " + toString(static_cast<int>(functionType->kind())) + " not yet implemented");
|
solUnimplemented("FunctionKind " + toString(static_cast<int>(functionType->kind())) + " not yet implemented");
|
||||||
}
|
}
|
||||||
|
@ -1238,11 +1238,13 @@ BOOST_AUTO_TEST_CASE(selfdestruct)
|
|||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
u256 amount(130);
|
u256 amount(130);
|
||||||
compileAndRun(sourceCode, amount);
|
|
||||||
u160 address(23);
|
u160 address(23);
|
||||||
ABI_CHECK(callContractFunction("a(address)", address), bytes());
|
ALSO_VIA_YUL(
|
||||||
BOOST_CHECK(!addressHasCode(m_contractAddress));
|
compileAndRun(sourceCode, amount);
|
||||||
BOOST_CHECK_EQUAL(balanceAt(address), amount);
|
ABI_CHECK(callContractFunction("a(address)", address), bytes());
|
||||||
|
BOOST_CHECK(!addressHasCode(m_contractAddress));
|
||||||
|
BOOST_CHECK_EQUAL(balanceAt(address), amount);
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(keccak256)
|
BOOST_AUTO_TEST_CASE(keccak256)
|
||||||
|
Loading…
Reference in New Issue
Block a user