fix decompiler empty switch cases
This commit is contained in:
parent
3236e6e079
commit
ced80282e8
@ -2504,12 +2504,13 @@ void decompiler::decompile_switch(const ast::stmt_list::ptr& stmt, std::size_t s
|
||||
|
||||
end = find_location_index(stmt, end_loc); // update end
|
||||
|
||||
// fix empty cases at end
|
||||
if (stmt->list.at(end) == ast::kind::asm_endswitch)
|
||||
while (stmt->list.size() > (end + 1) && stmt->list.at(end) != ast::kind::asm_endswitch)
|
||||
end++;
|
||||
|
||||
if (stmt->list.at(end) != ast::kind::asm_endswitch)
|
||||
decomp_error("bad empty cases in switch block!");
|
||||
|
||||
end--;
|
||||
|
||||
// TODO: fix more than 1 empty case at end
|
||||
|
||||
stmt->list.erase(stmt->list.begin() + start); // remove 'switch'
|
||||
stmt->list.erase(stmt->list.begin() + end); // remove 'endswitch'
|
||||
|
||||
|
@ -2504,12 +2504,13 @@ void decompiler::decompile_switch(const ast::stmt_list::ptr& stmt, std::size_t s
|
||||
|
||||
end = find_location_index(stmt, end_loc); // update end
|
||||
|
||||
// fix empty cases at end
|
||||
if (stmt->list.at(end) == ast::kind::asm_endswitch)
|
||||
while (stmt->list.size() > (end + 1) && stmt->list.at(end) != ast::kind::asm_endswitch)
|
||||
end++;
|
||||
|
||||
if (stmt->list.at(end) != ast::kind::asm_endswitch)
|
||||
decomp_error("bad empty cases in switch block!");
|
||||
|
||||
end--;
|
||||
|
||||
// TODO: fix more than 1 empty case at end
|
||||
|
||||
stmt->list.erase(stmt->list.begin() + start); // remove 'switch'
|
||||
stmt->list.erase(stmt->list.begin() + end); // remove 'endswitch'
|
||||
|
||||
|
@ -2498,12 +2498,13 @@ void decompiler::decompile_switch(const ast::stmt_list::ptr& stmt, std::size_t s
|
||||
|
||||
end = find_location_index(stmt, end_loc); // update end
|
||||
|
||||
// fix empty cases at end
|
||||
if (stmt->list.at(end) == ast::kind::asm_endswitch)
|
||||
while (stmt->list.size() > (end + 1) && stmt->list.at(end) != ast::kind::asm_endswitch)
|
||||
end++;
|
||||
|
||||
if (stmt->list.at(end) != ast::kind::asm_endswitch)
|
||||
decomp_error("bad empty cases in switch block!");
|
||||
|
||||
end--;
|
||||
|
||||
// TODO: fix more than 1 empty case at end
|
||||
|
||||
stmt->list.erase(stmt->list.begin() + start); // remove 'switch'
|
||||
stmt->list.erase(stmt->list.begin() + end); // remove 'endswitch'
|
||||
|
||||
|
@ -2498,12 +2498,13 @@ void decompiler::decompile_switch(const ast::stmt_list::ptr& stmt, std::size_t s
|
||||
|
||||
end = find_location_index(stmt, end_loc); // update end
|
||||
|
||||
// fix empty cases at end
|
||||
if (stmt->list.at(end) == ast::kind::asm_endswitch)
|
||||
while (stmt->list.size() > (end + 1) && stmt->list.at(end) != ast::kind::asm_endswitch)
|
||||
end++;
|
||||
|
||||
if (stmt->list.at(end) != ast::kind::asm_endswitch)
|
||||
decomp_error("bad empty cases in switch block!");
|
||||
|
||||
end--;
|
||||
|
||||
// TODO: fix more than 1 empty case at end
|
||||
|
||||
stmt->list.erase(stmt->list.begin() + start); // remove 'switch'
|
||||
stmt->list.erase(stmt->list.begin() + end); // remove 'endswitch'
|
||||
|
||||
|
@ -2498,12 +2498,13 @@ void decompiler::decompile_switch(const ast::stmt_list::ptr& stmt, std::size_t s
|
||||
|
||||
end = find_location_index(stmt, end_loc); // update end
|
||||
|
||||
// fix empty cases at end
|
||||
if (stmt->list.at(end) == ast::kind::asm_endswitch)
|
||||
while (stmt->list.size() > (end + 1) && stmt->list.at(end) != ast::kind::asm_endswitch)
|
||||
end++;
|
||||
|
||||
if (stmt->list.at(end) != ast::kind::asm_endswitch)
|
||||
decomp_error("bad empty cases in switch block!");
|
||||
|
||||
end--;
|
||||
|
||||
// TODO: fix more than 1 empty case at end
|
||||
|
||||
stmt->list.erase(stmt->list.begin() + start); // remove 'switch'
|
||||
stmt->list.erase(stmt->list.begin() + end); // remove 'endswitch'
|
||||
|
||||
|
@ -2535,12 +2535,13 @@ void decompiler::decompile_switch(const ast::stmt_list::ptr& stmt, std::size_t s
|
||||
|
||||
end = find_location_index(stmt, end_loc); // update end
|
||||
|
||||
// fix empty cases at end
|
||||
if (stmt->list.at(end) == ast::kind::asm_endswitch)
|
||||
while (stmt->list.size() > (end + 1) && stmt->list.at(end) != ast::kind::asm_endswitch)
|
||||
end++;
|
||||
|
||||
if (stmt->list.at(end) != ast::kind::asm_endswitch)
|
||||
decomp_error("bad empty cases in switch block!");
|
||||
|
||||
end--;
|
||||
|
||||
// TODO: fix more than 1 empty case at end
|
||||
|
||||
stmt->list.erase(stmt->list.begin() + start); // remove 'switch'
|
||||
stmt->list.erase(stmt->list.begin() + end); // remove 'endswitch'
|
||||
|
||||
|
@ -2504,12 +2504,13 @@ void decompiler::decompile_switch(const ast::stmt_list::ptr& stmt, std::size_t s
|
||||
|
||||
end = find_location_index(stmt, end_loc); // update end
|
||||
|
||||
// fix empty cases at end
|
||||
if (stmt->list.at(end) == ast::kind::asm_endswitch)
|
||||
while (stmt->list.size() > (end + 1) && stmt->list.at(end) != ast::kind::asm_endswitch)
|
||||
end++;
|
||||
|
||||
if (stmt->list.at(end) != ast::kind::asm_endswitch)
|
||||
decomp_error("bad empty cases in switch block!");
|
||||
|
||||
end--;
|
||||
|
||||
// TODO: fix more than 1 empty case at end
|
||||
|
||||
stmt->list.erase(stmt->list.begin() + start); // remove 'switch'
|
||||
stmt->list.erase(stmt->list.begin() + end); // remove 'endswitch'
|
||||
|
||||
|
@ -2511,12 +2511,13 @@ void decompiler::decompile_switch(const ast::stmt_list::ptr& stmt, std::size_t s
|
||||
|
||||
end = find_location_index(stmt, end_loc); // update end
|
||||
|
||||
// fix empty cases at end
|
||||
if (stmt->list.at(end) == ast::kind::asm_endswitch)
|
||||
while (stmt->list.size() > (end + 1) && stmt->list.at(end) != ast::kind::asm_endswitch)
|
||||
end++;
|
||||
|
||||
if (stmt->list.at(end) != ast::kind::asm_endswitch)
|
||||
decomp_error("bad empty cases in switch block!");
|
||||
|
||||
end--;
|
||||
|
||||
// TODO: fix more than 1 empty case at end
|
||||
|
||||
stmt->list.erase(stmt->list.begin() + start); // remove 'switch'
|
||||
stmt->list.erase(stmt->list.begin() + end); // remove 'endswitch'
|
||||
|
||||
|
@ -2535,12 +2535,13 @@ void decompiler::decompile_switch(const ast::stmt_list::ptr& stmt, std::size_t s
|
||||
|
||||
end = find_location_index(stmt, end_loc); // update end
|
||||
|
||||
// fix empty cases at end
|
||||
if (stmt->list.at(end) == ast::kind::asm_endswitch)
|
||||
while (stmt->list.size() > (end + 1) && stmt->list.at(end) != ast::kind::asm_endswitch)
|
||||
end++;
|
||||
|
||||
if (stmt->list.at(end) != ast::kind::asm_endswitch)
|
||||
decomp_error("bad empty cases in switch block!");
|
||||
|
||||
end--;
|
||||
|
||||
// TODO: fix more than 1 empty case at end
|
||||
|
||||
stmt->list.erase(stmt->list.begin() + start); // remove 'switch'
|
||||
stmt->list.erase(stmt->list.begin() + end); // remove 'endswitch'
|
||||
|
||||
|
@ -1915,10 +1915,13 @@ void decompiler::decompile_switch(const ast::stmt_list::ptr& stmt, std::size_t s
|
||||
|
||||
end = find_location_index(stmt, end_loc); // update end
|
||||
|
||||
// fix empty cases at end
|
||||
if (stmt->list.at(end) == ast::kind::asm_endswitch)
|
||||
end--;
|
||||
while (stmt->list.size() > (end + 1) && stmt->list.at(end) != ast::kind::asm_endswitch)
|
||||
end++;
|
||||
|
||||
if (stmt->list.at(end) != ast::kind::asm_endswitch)
|
||||
decomp_error("bad empty cases in switch block!");
|
||||
|
||||
end--;
|
||||
stmt->list.erase(stmt->list.begin() + start); // remove 'switch'
|
||||
stmt->list.erase(stmt->list.begin() + end); // remove 'endswitch'
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user