Skip to content

Commit

Permalink
🔥 update to no pos
Browse files Browse the repository at this point in the history
  • Loading branch information
fennecdjay committed Jan 30, 2024
1 parent aa633ad commit 3095d65
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions include/absyn.h
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ struct Exp_ {
Exp next;
Exp ref;
void *data;
loc_t pos; ///< position
loc_t loc;
ae_exp_t exp_type;
int16_t emit_var;
enum exp_comptime comptime;
Expand Down Expand Up @@ -412,7 +412,7 @@ static inline Exp prim_exp(const void *data) {
}
static inline loc_t prim_pos(const void *data) {
const Exp e = prim_exp(data);
return e->pos;
return e->loc;
}

ANEW ANN AST_NEW(Exp, prim_id, struct Symbol_ *, const loc_t);
Expand Down
2 changes: 1 addition & 1 deletion src/ast_cpy.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ ANN Exp cpy_exp(MemPool p, const Exp src) {
a->exp_type = src->exp_type;
a->emit_var = src->emit_var;
// a->meta = src->meta;// maybe meta shoyuld be set as in constructors
a->pos = src->pos;
a->loc = src->loc;
return a;
}

Expand Down
2 changes: 1 addition & 1 deletion src/ast_new.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Array_Sub prepend_array_sub(const Array_Sub a, const Exp exp) {
ANN static AST_NEW(Exp, exp, const ae_exp_t type, const loc_t loc) {
Exp a = mp_calloc(p, Exp);
a->exp_type = type;
a->pos = loc;
a->loc = loc;
return a;
}

Expand Down
2 changes: 1 addition & 1 deletion src/gwion.y
Original file line number Diff line number Diff line change
Expand Up @@ -1050,7 +1050,7 @@ interp: INTERP_START interp_exp { $$ = $2; }
char c[strlen($1->d.prim.d.string.data) + strlen($3->d.prim.d.string.data) + 1];
sprintf(c, "%s%s\n", $1->d.prim.d.string.data, $3->d.prim.d.string.data);
$1->d.prim.d.string.data = s_name(insert_symbol(c));
$1->pos.last = $3->pos.last;
$1->loc.last = $3->loc.last;
free_exp(mpool(arg), $3);
} else
$1->next = $3;
Expand Down
2 changes: 1 addition & 1 deletion src/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -4459,7 +4459,7 @@ mp_vector_add(mpool(arg), &(yyvsp[-1].handler_list).handlers, Handler, (yyvsp[0]
char c[strlen((yyvsp[-2].exp)->d.prim.d.string.data) + strlen((yyvsp[0].exp)->d.prim.d.string.data) + 1];
sprintf(c, "%s%s\n", (yyvsp[-2].exp)->d.prim.d.string.data, (yyvsp[0].exp)->d.prim.d.string.data);
(yyvsp[-2].exp)->d.prim.d.string.data = s_name(insert_symbol(c));
(yyvsp[-2].exp)->pos.last = (yyvsp[0].exp)->pos.last;
(yyvsp[-2].exp)->loc.last = (yyvsp[0].exp)->loc.last;
free_exp(mpool(arg), (yyvsp[0].exp));
} else
(yyvsp[-2].exp)->next = (yyvsp[0].exp);
Expand Down

0 comments on commit 3095d65

Please sign in to comment.