compiler waittill fix

This commit is contained in:
xensik 2021-05-12 12:08:30 +02:00
parent 39ac8bd592
commit ec1513100e
8 changed files with 1 additions and 43 deletions

View File

@ -288,8 +288,6 @@ void compiler::emit_stmt_waittill(const gsc::context_ptr& ctx, const gsc::stmt_w
emit_expr(ctx, stmt->obj); emit_expr(ctx, stmt->obj);
emit_opcode(ctx, opcode::OP_waittill); emit_opcode(ctx, opcode::OP_waittill);
std::reverse(stmt->args->list.begin(), stmt->args->list.end());
for(const auto& arg : stmt->args->list) for(const auto& arg : stmt->args->list)
{ {
create_variable(ctx, arg.as_name); create_variable(ctx, arg.as_name);
@ -1760,14 +1758,10 @@ void compiler::process_expr(const gsc::context_ptr& ctx, const gsc::expr_ptr& ex
void compiler::process_stmt_waittill(const gsc::context_ptr& ctx, const gsc::stmt_waittill_ptr& stmt) void compiler::process_stmt_waittill(const gsc::context_ptr& ctx, const gsc::stmt_waittill_ptr& stmt)
{ {
std::reverse(stmt->args->list.begin(), stmt->args->list.end());
for(const auto& arg : stmt->args->list) for(const auto& arg : stmt->args->list)
{ {
register_variable(ctx, arg.as_name->value); register_variable(ctx, arg.as_name->value);
} }
std::reverse(stmt->args->list.begin(), stmt->args->list.end());
} }
void compiler::process_stmt_if(const gsc::context_ptr& ctx, const gsc::stmt_if_ptr& stmt) void compiler::process_stmt_if(const gsc::context_ptr& ctx, const gsc::stmt_if_ptr& stmt)

View File

@ -288,8 +288,6 @@ void compiler::emit_stmt_waittill(const gsc::context_ptr& ctx, const gsc::stmt_w
emit_expr(ctx, stmt->obj); emit_expr(ctx, stmt->obj);
emit_opcode(ctx, opcode::OP_waittill); emit_opcode(ctx, opcode::OP_waittill);
std::reverse(stmt->args->list.begin(), stmt->args->list.end());
for(const auto& arg : stmt->args->list) for(const auto& arg : stmt->args->list)
{ {
create_variable(ctx, arg.as_name); create_variable(ctx, arg.as_name);
@ -1760,14 +1758,10 @@ void compiler::process_expr(const gsc::context_ptr& ctx, const gsc::expr_ptr& ex
void compiler::process_stmt_waittill(const gsc::context_ptr& ctx, const gsc::stmt_waittill_ptr& stmt) void compiler::process_stmt_waittill(const gsc::context_ptr& ctx, const gsc::stmt_waittill_ptr& stmt)
{ {
std::reverse(stmt->args->list.begin(), stmt->args->list.end());
for(const auto& arg : stmt->args->list) for(const auto& arg : stmt->args->list)
{ {
register_variable(ctx, arg.as_name->value); register_variable(ctx, arg.as_name->value);
} }
std::reverse(stmt->args->list.begin(), stmt->args->list.end());
} }
void compiler::process_stmt_if(const gsc::context_ptr& ctx, const gsc::stmt_if_ptr& stmt) void compiler::process_stmt_if(const gsc::context_ptr& ctx, const gsc::stmt_if_ptr& stmt)

View File

@ -261,7 +261,7 @@ void assembler::assemble_instruction(const gsc::instruction_ptr& inst)
break; break;
case opcode::OP_waittillmatch: case opcode::OP_waittillmatch:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode)); script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
script_->write<std::uint16_t>(static_cast<std::uint16_t>(std::stoi(inst->data[0]))); script_->write<std::uint16_t>(0);
break; break;
case opcode::OP_CreateLocalVariable: case opcode::OP_CreateLocalVariable:
case opcode::OP_RemoveLocalVariables: case opcode::OP_RemoveLocalVariables:

View File

@ -287,8 +287,6 @@ void compiler::emit_stmt_waittill(const gsc::context_ptr& ctx, const gsc::stmt_w
emit_expr(ctx, stmt->obj); emit_expr(ctx, stmt->obj);
emit_opcode(ctx, opcode::OP_waittill); emit_opcode(ctx, opcode::OP_waittill);
std::reverse(stmt->args->list.begin(), stmt->args->list.end());
for(const auto& arg : stmt->args->list) for(const auto& arg : stmt->args->list)
{ {
create_variable(ctx, arg.as_name); create_variable(ctx, arg.as_name);
@ -1754,14 +1752,10 @@ void compiler::process_expr(const gsc::context_ptr& ctx, const gsc::expr_ptr& ex
void compiler::process_stmt_waittill(const gsc::context_ptr& ctx, const gsc::stmt_waittill_ptr& stmt) void compiler::process_stmt_waittill(const gsc::context_ptr& ctx, const gsc::stmt_waittill_ptr& stmt)
{ {
std::reverse(stmt->args->list.begin(), stmt->args->list.end());
for(const auto& arg : stmt->args->list) for(const auto& arg : stmt->args->list)
{ {
register_variable(ctx, arg.as_name->value); register_variable(ctx, arg.as_name->value);
} }
std::reverse(stmt->args->list.begin(), stmt->args->list.end());
} }
void compiler::process_stmt_if(const gsc::context_ptr& ctx, const gsc::stmt_if_ptr& stmt) void compiler::process_stmt_if(const gsc::context_ptr& ctx, const gsc::stmt_if_ptr& stmt)

View File

@ -287,8 +287,6 @@ void compiler::emit_stmt_waittill(const gsc::context_ptr& ctx, const gsc::stmt_w
emit_expr(ctx, stmt->obj); emit_expr(ctx, stmt->obj);
emit_opcode(ctx, opcode::OP_waittill); emit_opcode(ctx, opcode::OP_waittill);
std::reverse(stmt->args->list.begin(), stmt->args->list.end());
for(const auto& arg : stmt->args->list) for(const auto& arg : stmt->args->list)
{ {
create_variable(ctx, arg.as_name); create_variable(ctx, arg.as_name);
@ -1754,14 +1752,10 @@ void compiler::process_expr(const gsc::context_ptr& ctx, const gsc::expr_ptr& ex
void compiler::process_stmt_waittill(const gsc::context_ptr& ctx, const gsc::stmt_waittill_ptr& stmt) void compiler::process_stmt_waittill(const gsc::context_ptr& ctx, const gsc::stmt_waittill_ptr& stmt)
{ {
std::reverse(stmt->args->list.begin(), stmt->args->list.end());
for(const auto& arg : stmt->args->list) for(const auto& arg : stmt->args->list)
{ {
register_variable(ctx, arg.as_name->value); register_variable(ctx, arg.as_name->value);
} }
std::reverse(stmt->args->list.begin(), stmt->args->list.end());
} }
void compiler::process_stmt_if(const gsc::context_ptr& ctx, const gsc::stmt_if_ptr& stmt) void compiler::process_stmt_if(const gsc::context_ptr& ctx, const gsc::stmt_if_ptr& stmt)

View File

@ -287,8 +287,6 @@ void compiler::emit_stmt_waittill(const gsc::context_ptr& ctx, const gsc::stmt_w
emit_expr(ctx, stmt->obj); emit_expr(ctx, stmt->obj);
emit_opcode(ctx, opcode::OP_waittill); emit_opcode(ctx, opcode::OP_waittill);
std::reverse(stmt->args->list.begin(), stmt->args->list.end());
for(const auto& arg : stmt->args->list) for(const auto& arg : stmt->args->list)
{ {
create_variable(ctx, arg.as_name); create_variable(ctx, arg.as_name);
@ -1754,14 +1752,10 @@ void compiler::process_expr(const gsc::context_ptr& ctx, const gsc::expr_ptr& ex
void compiler::process_stmt_waittill(const gsc::context_ptr& ctx, const gsc::stmt_waittill_ptr& stmt) void compiler::process_stmt_waittill(const gsc::context_ptr& ctx, const gsc::stmt_waittill_ptr& stmt)
{ {
std::reverse(stmt->args->list.begin(), stmt->args->list.end());
for(const auto& arg : stmt->args->list) for(const auto& arg : stmt->args->list)
{ {
register_variable(ctx, arg.as_name->value); register_variable(ctx, arg.as_name->value);
} }
std::reverse(stmt->args->list.begin(), stmt->args->list.end());
} }
void compiler::process_stmt_if(const gsc::context_ptr& ctx, const gsc::stmt_if_ptr& stmt) void compiler::process_stmt_if(const gsc::context_ptr& ctx, const gsc::stmt_if_ptr& stmt)

View File

@ -288,8 +288,6 @@ void compiler::emit_stmt_waittill(const gsc::context_ptr& ctx, const gsc::stmt_w
emit_expr(ctx, stmt->obj); emit_expr(ctx, stmt->obj);
emit_opcode(ctx, opcode::OP_waittill); emit_opcode(ctx, opcode::OP_waittill);
std::reverse(stmt->args->list.begin(), stmt->args->list.end());
for(const auto& arg : stmt->args->list) for(const auto& arg : stmt->args->list)
{ {
create_variable(ctx, arg.as_name); create_variable(ctx, arg.as_name);
@ -1760,14 +1758,10 @@ void compiler::process_expr(const gsc::context_ptr& ctx, const gsc::expr_ptr& ex
void compiler::process_stmt_waittill(const gsc::context_ptr& ctx, const gsc::stmt_waittill_ptr& stmt) void compiler::process_stmt_waittill(const gsc::context_ptr& ctx, const gsc::stmt_waittill_ptr& stmt)
{ {
std::reverse(stmt->args->list.begin(), stmt->args->list.end());
for(const auto& arg : stmt->args->list) for(const auto& arg : stmt->args->list)
{ {
register_variable(ctx, arg.as_name->value); register_variable(ctx, arg.as_name->value);
} }
std::reverse(stmt->args->list.begin(), stmt->args->list.end());
} }
void compiler::process_stmt_if(const gsc::context_ptr& ctx, const gsc::stmt_if_ptr& stmt) void compiler::process_stmt_if(const gsc::context_ptr& ctx, const gsc::stmt_if_ptr& stmt)

View File

@ -288,8 +288,6 @@ void compiler::emit_stmt_waittill(const gsc::context_ptr& ctx, const gsc::stmt_w
emit_expr(ctx, stmt->obj); emit_expr(ctx, stmt->obj);
emit_opcode(ctx, opcode::OP_waittill); emit_opcode(ctx, opcode::OP_waittill);
std::reverse(stmt->args->list.begin(), stmt->args->list.end());
for(const auto& arg : stmt->args->list) for(const auto& arg : stmt->args->list)
{ {
create_variable(ctx, arg.as_name); create_variable(ctx, arg.as_name);
@ -1760,14 +1758,10 @@ void compiler::process_expr(const gsc::context_ptr& ctx, const gsc::expr_ptr& ex
void compiler::process_stmt_waittill(const gsc::context_ptr& ctx, const gsc::stmt_waittill_ptr& stmt) void compiler::process_stmt_waittill(const gsc::context_ptr& ctx, const gsc::stmt_waittill_ptr& stmt)
{ {
std::reverse(stmt->args->list.begin(), stmt->args->list.end());
for(const auto& arg : stmt->args->list) for(const auto& arg : stmt->args->list)
{ {
register_variable(ctx, arg.as_name->value); register_variable(ctx, arg.as_name->value);
} }
std::reverse(stmt->args->list.begin(), stmt->args->list.end());
} }
void compiler::process_stmt_if(const gsc::context_ptr& ctx, const gsc::stmt_if_ptr& stmt) void compiler::process_stmt_if(const gsc::context_ptr& ctx, const gsc::stmt_if_ptr& stmt)