Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(arc): refactor regressions #123

Merged
merged 3 commits into from
May 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions gen/arc/parser.ypp
Original file line number Diff line number Diff line change
Expand Up @@ -734,9 +734,22 @@ expr_call
: expr_function { $$ = expr_call::make(@$, std::move($1)); }
| expr_pointer { $$ = expr_call::make(@$, std::move($1)); }
;

expr_method
: expr_object expr_function { $$ = expr_method::make(@$, std::move($1), std::move($2)); }
| expr_object expr_pointer { $$ = expr_method::make(@$, std::move($1), std::move($2)); }
: expr_object expr_function
{
if ($1->loc().begin.line != $2->loc().begin.line)
error($2->loc(), "missing ';' ?");

$$ = expr_method::make(@$, std::move($1), std::move($2));
}
| expr_object expr_pointer
{
if ($1->loc().begin.line != $2->loc().begin.line)
error($2->loc(), "missing ';' ?");

$$ = expr_method::make(@$, std::move($1), std::move($2));
}
;

expr_function
Expand Down
17 changes: 15 additions & 2 deletions gen/gsc/parser.ypp
Original file line number Diff line number Diff line change
Expand Up @@ -728,9 +728,22 @@ expr_call
: expr_function { $$ = expr_call::make(@$, std::move($1)); }
| expr_pointer { $$ = expr_call::make(@$, std::move($1)); }
;

expr_method
: expr_object expr_function { $$ = expr_method::make(@$, std::move($1), std::move($2)); }
| expr_object expr_pointer { $$ = expr_method::make(@$, std::move($1), std::move($2)); }
: expr_object expr_function
{
if ($1->loc().begin.line != $2->loc().begin.line)
error($2->loc(), "missing ';' ?");

$$ = expr_method::make(@$, std::move($1), std::move($2));
}
| expr_object expr_pointer
{
if ($1->loc().begin.line != $2->loc().begin.line)
error($2->loc(), "missing ';' ?");

$$ = expr_method::make(@$, std::move($1), std::move($2));
}
;

expr_function
Expand Down
2 changes: 1 addition & 1 deletion src/arc/assembler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ auto assembler::assemble(assembly const& data) -> buffer
if (ctx_->props() & props::size64)
script_.write<u32>(head.name);
else
script_.write<u32>(head.name);
script_.write<u16>(static_cast<u16>(head.name));

script_.write<u16>(head.stringtablefixup_count);
script_.write<u16>(head.exports_count);
Expand Down
6 changes: 2 additions & 4 deletions src/arc/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,8 @@ auto compiler::emit_stmt_ifelse(stmt_ifelse const& stm) -> void

insert_label(else_loc);

paren = scopes_.back();
scopes_.push_back(scope(paren.brk, paren.cnt));
auto& paren2 = scopes_.back();
scopes_.push_back(scope(paren2.brk, paren2.cnt));
emit_stmt(*stm.stmt_else);
scopes_.pop_back();

Expand Down Expand Up @@ -936,7 +936,6 @@ auto compiler::emit_expr_increment(expr_increment const& exp, bool is_stmt) -> v
{
emit_expr_variable_ref(*exp.lvalue, false);
emit_opcode(opcode::OP_Inc);
emit_opcode(opcode::OP_SetVariableField);
}
else
{
Expand All @@ -950,7 +949,6 @@ auto compiler::emit_expr_decrement(expr_decrement const& exp, bool is_stmt) -> v
{
emit_expr_variable_ref(*exp.lvalue, false);
emit_opcode(opcode::OP_Dec);
emit_opcode(opcode::OP_SetVariableField);
}
else
{
Expand Down
Loading