mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #9243 from ethereum/jumpTypesForYul
Jump types for yul functions.
This commit is contained in:
@@ -182,6 +182,30 @@ BOOST_AUTO_TEST_CASE(location_test)
|
||||
checkAssemblyLocations(items, locations);
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(jump_type)
|
||||
{
|
||||
auto sourceCode = make_shared<CharStream>(R"(
|
||||
contract C {
|
||||
function f(uint a) public pure returns (uint t) {
|
||||
assembly {
|
||||
function g(x) -> y { if x { leave } y := 8 }
|
||||
t := g(a)
|
||||
}
|
||||
}
|
||||
}
|
||||
)", "");
|
||||
AssemblyItems items = compileContract(sourceCode);
|
||||
|
||||
string jumpTypes;
|
||||
for (AssemblyItem const& item: items)
|
||||
if (item.getJumpType() != AssemblyItem::JumpType::Ordinary)
|
||||
jumpTypes += item.getJumpTypeAsString() + "\n";
|
||||
|
||||
BOOST_CHECK_EQUAL(jumpTypes, "[in]\n[out]\n[in]\n[out]\n");
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
} // end namespaces
|
||||
|
||||
Reference in New Issue
Block a user