Skip to content

Commit

Permalink
fix: Fix ref
Browse files Browse the repository at this point in the history
  • Loading branch information
keyvank committed Oct 20, 2024
1 parent 4b75dc3 commit bc42554
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions parser/expr/ref.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@ void ref_debug(int depth, parser_node *node)
apply_result *ref_apply(parser_node *node, context *ctx)
{
node_ref *ref = (node_ref *)node->data;
node_var *v = (node_var *)ref->var->data;
symbol *sym = find_symbol(ctx, v->var_name);
add_text(ctx, "mov rax, rsp");
add_text(ctx, "add rax, %u", sym->offset);
symbol *res = new_temp_symbol(ctx, new_pointer_type(sym->type));
apply_result *v = ref->var->apply(ref->var, ctx);
add_text(ctx, "mov rax, %s", v->addr_code);
symbol *res = new_temp_symbol(ctx, new_pointer_type(v->type));
add_text(ctx, "mov %s, rax", res->repl);
return new_result(res->repl, res->type);
}
Expand Down

0 comments on commit bc42554

Please sign in to comment.