mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Swap mutated block and if body and switch-case body blocks
This commit is contained in:
parent
145a4ee645
commit
17a69bbe90
@ -469,8 +469,9 @@ static YulProtoMutator addIf(
|
|||||||
std::cout << "YULMUTATOR: Add if" << std::endl;
|
std::cout << "YULMUTATOR: Add if" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
auto block = static_cast<Block*>(_message);
|
auto block = static_cast<Block*>(_message);
|
||||||
auto stmt = block->add_statements();
|
|
||||||
auto ifStmt = new IfStmt();
|
auto ifStmt = new IfStmt();
|
||||||
|
ifStmt->mutable_if_body()->Swap(block);
|
||||||
|
auto stmt = block->add_statements();
|
||||||
stmt->set_allocated_ifstmt(ifStmt);
|
stmt->set_allocated_ifstmt(ifStmt);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cout << protobuf_mutator::SaveMessageAsText(*_message) << std::endl;
|
std::cout << protobuf_mutator::SaveMessageAsText(*_message) << std::endl;
|
||||||
@ -518,8 +519,10 @@ static YulProtoMutator addSwitch(
|
|||||||
std::cout << "YULMUTATOR: Add switch" << std::endl;
|
std::cout << "YULMUTATOR: Add switch" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
auto block = static_cast<Block*>(_message);
|
auto block = static_cast<Block*>(_message);
|
||||||
auto stmt = block->add_statements();
|
|
||||||
auto switchStmt = new SwitchStmt();
|
auto switchStmt = new SwitchStmt();
|
||||||
|
auto caseStmt = switchStmt->add_case_stmt();
|
||||||
|
caseStmt->mutable_case_block()->Swap(block);
|
||||||
|
auto stmt = block->add_statements();
|
||||||
stmt->set_allocated_switchstmt(switchStmt);
|
stmt->set_allocated_switchstmt(switchStmt);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cout << protobuf_mutator::SaveMessageAsText(*_message) << std::endl;
|
std::cout << protobuf_mutator::SaveMessageAsText(*_message) << std::endl;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user