fix default order
This commit is contained in:
parent
7fd69dc70c
commit
e25d69e74a
@ -615,6 +615,11 @@ void compiler::emit_stmt_switch(const gsc::context_ptr& ctx, const gsc::stmt_swi
|
||||
|
||||
if(entry.as_node->type == gsc::node_t::stmt_case)
|
||||
{
|
||||
if(has_default)
|
||||
{
|
||||
gsc::comp_error(stmt->loc, "default must be last case");
|
||||
}
|
||||
|
||||
auto& case_ = entry.as_case;
|
||||
if(case_->value.as_node->type == gsc::node_t::data_integer)
|
||||
{
|
||||
|
@ -2525,6 +2525,8 @@ void decompiler::decompile_switch(const gsc::stmt_list_ptr& block, std::uint32_t
|
||||
auto list = std::make_unique<gsc::node_stmt_list>(loc);
|
||||
list->is_case = true;
|
||||
auto stmt = gsc::stmt_ptr(std::make_unique<gsc::node_stmt_default>(loc_pos, std::move(list)));
|
||||
while(block->stmts.at(loc_idx).as_node->type == gsc::node_t::stmt_case)
|
||||
loc_idx++;
|
||||
block->stmts.insert(block->stmts.begin() + loc_idx, std::move(stmt));
|
||||
idx += 2;
|
||||
}
|
||||
|
@ -615,6 +615,11 @@ void compiler::emit_stmt_switch(const gsc::context_ptr& ctx, const gsc::stmt_swi
|
||||
|
||||
if(entry.as_node->type == gsc::node_t::stmt_case)
|
||||
{
|
||||
if(has_default)
|
||||
{
|
||||
gsc::comp_error(stmt->loc, "default must be last case");
|
||||
}
|
||||
|
||||
auto& case_ = entry.as_case;
|
||||
if(case_->value.as_node->type == gsc::node_t::data_integer)
|
||||
{
|
||||
|
@ -2525,6 +2525,8 @@ void decompiler::decompile_switch(const gsc::stmt_list_ptr& block, std::uint32_t
|
||||
auto list = std::make_unique<gsc::node_stmt_list>(loc);
|
||||
list->is_case = true;
|
||||
auto stmt = gsc::stmt_ptr(std::make_unique<gsc::node_stmt_default>(loc_pos, std::move(list)));
|
||||
while(block->stmts.at(loc_idx).as_node->type == gsc::node_t::stmt_case)
|
||||
loc_idx++;
|
||||
block->stmts.insert(block->stmts.begin() + loc_idx, std::move(stmt));
|
||||
idx += 2;
|
||||
}
|
||||
|
@ -609,6 +609,11 @@ void compiler::emit_stmt_switch(const gsc::context_ptr& ctx, const gsc::stmt_swi
|
||||
|
||||
if(entry.as_node->type == gsc::node_t::stmt_case)
|
||||
{
|
||||
if(has_default)
|
||||
{
|
||||
gsc::comp_error(stmt->loc, "default must be last case");
|
||||
}
|
||||
|
||||
auto& case_ = entry.as_case;
|
||||
if(case_->value.as_node->type == gsc::node_t::data_integer)
|
||||
{
|
||||
|
@ -2519,6 +2519,8 @@ void decompiler::decompile_switch(const gsc::stmt_list_ptr& block, std::uint32_t
|
||||
auto list = std::make_unique<gsc::node_stmt_list>(loc);
|
||||
list->is_case = true;
|
||||
auto stmt = gsc::stmt_ptr(std::make_unique<gsc::node_stmt_default>(loc_pos, std::move(list)));
|
||||
while(block->stmts.at(loc_idx).as_node->type == gsc::node_t::stmt_case)
|
||||
loc_idx++;
|
||||
block->stmts.insert(block->stmts.begin() + loc_idx, std::move(stmt));
|
||||
idx += 2;
|
||||
}
|
||||
|
@ -609,6 +609,11 @@ void compiler::emit_stmt_switch(const gsc::context_ptr& ctx, const gsc::stmt_swi
|
||||
|
||||
if(entry.as_node->type == gsc::node_t::stmt_case)
|
||||
{
|
||||
if(has_default)
|
||||
{
|
||||
gsc::comp_error(stmt->loc, "default must be last case");
|
||||
}
|
||||
|
||||
auto& case_ = entry.as_case;
|
||||
if(case_->value.as_node->type == gsc::node_t::data_integer)
|
||||
{
|
||||
|
@ -2519,6 +2519,8 @@ void decompiler::decompile_switch(const gsc::stmt_list_ptr& block, std::uint32_t
|
||||
auto list = std::make_unique<gsc::node_stmt_list>(loc);
|
||||
list->is_case = true;
|
||||
auto stmt = gsc::stmt_ptr(std::make_unique<gsc::node_stmt_default>(loc_pos, std::move(list)));
|
||||
while(block->stmts.at(loc_idx).as_node->type == gsc::node_t::stmt_case)
|
||||
loc_idx++;
|
||||
block->stmts.insert(block->stmts.begin() + loc_idx, std::move(stmt));
|
||||
idx += 2;
|
||||
}
|
||||
|
@ -609,6 +609,11 @@ void compiler::emit_stmt_switch(const gsc::context_ptr& ctx, const gsc::stmt_swi
|
||||
|
||||
if(entry.as_node->type == gsc::node_t::stmt_case)
|
||||
{
|
||||
if(has_default)
|
||||
{
|
||||
gsc::comp_error(stmt->loc, "default must be last case");
|
||||
}
|
||||
|
||||
auto& case_ = entry.as_case;
|
||||
if(case_->value.as_node->type == gsc::node_t::data_integer)
|
||||
{
|
||||
|
@ -2519,6 +2519,8 @@ void decompiler::decompile_switch(const gsc::stmt_list_ptr& block, std::uint32_t
|
||||
auto list = std::make_unique<gsc::node_stmt_list>(loc);
|
||||
list->is_case = true;
|
||||
auto stmt = gsc::stmt_ptr(std::make_unique<gsc::node_stmt_default>(loc_pos, std::move(list)));
|
||||
while(block->stmts.at(loc_idx).as_node->type == gsc::node_t::stmt_case)
|
||||
loc_idx++;
|
||||
block->stmts.insert(block->stmts.begin() + loc_idx, std::move(stmt));
|
||||
idx += 2;
|
||||
}
|
||||
|
@ -615,6 +615,11 @@ void compiler::emit_stmt_switch(const gsc::context_ptr& ctx, const gsc::stmt_swi
|
||||
|
||||
if(entry.as_node->type == gsc::node_t::stmt_case)
|
||||
{
|
||||
if(has_default)
|
||||
{
|
||||
gsc::comp_error(stmt->loc, "default must be last case");
|
||||
}
|
||||
|
||||
auto& case_ = entry.as_case;
|
||||
if(case_->value.as_node->type == gsc::node_t::data_integer)
|
||||
{
|
||||
|
@ -2525,6 +2525,8 @@ void decompiler::decompile_switch(const gsc::stmt_list_ptr& block, std::uint32_t
|
||||
auto list = std::make_unique<gsc::node_stmt_list>(loc);
|
||||
list->is_case = true;
|
||||
auto stmt = gsc::stmt_ptr(std::make_unique<gsc::node_stmt_default>(loc_pos, std::move(list)));
|
||||
while(block->stmts.at(loc_idx).as_node->type == gsc::node_t::stmt_case)
|
||||
loc_idx++;
|
||||
block->stmts.insert(block->stmts.begin() + loc_idx, std::move(stmt));
|
||||
idx += 2;
|
||||
}
|
||||
|
@ -615,6 +615,11 @@ void compiler::emit_stmt_switch(const gsc::context_ptr& ctx, const gsc::stmt_swi
|
||||
|
||||
if(entry.as_node->type == gsc::node_t::stmt_case)
|
||||
{
|
||||
if(has_default)
|
||||
{
|
||||
gsc::comp_error(stmt->loc, "default must be last case");
|
||||
}
|
||||
|
||||
auto& case_ = entry.as_case;
|
||||
if(case_->value.as_node->type == gsc::node_t::data_integer)
|
||||
{
|
||||
|
@ -2534,6 +2534,8 @@ void decompiler::decompile_switch(const gsc::stmt_list_ptr& block, std::uint32_t
|
||||
auto list = std::make_unique<gsc::node_stmt_list>(loc);
|
||||
list->is_case = true;
|
||||
auto stmt = gsc::stmt_ptr(std::make_unique<gsc::node_stmt_default>(loc_pos, std::move(list)));
|
||||
while(block->stmts.at(loc_idx).as_node->type == gsc::node_t::stmt_case)
|
||||
loc_idx++;
|
||||
block->stmts.insert(block->stmts.begin() + loc_idx, std::move(stmt));
|
||||
idx += 2;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user