Minor technical improvement

This commit is contained in:
gingerBill
2022-09-22 00:55:28 +01:00
parent c056a0d108
commit 532133d648

View File

@@ -3717,8 +3717,11 @@ lbAddr lb_build_addr_index_expr(lbProcedure *p, Ast *expr) {
ExactValue idx = exact_value_sub(index_tv.value, *t->EnumeratedArray.min_value);
index = lb_const_value(p->module, index_type, idx);
} else {
index = lb_emit_conv(p, lb_build_expr(p, ie->index), t_int);
index = lb_emit_arith(p, Token_Sub, index, lb_const_value(p->module, index_type, *t->EnumeratedArray.min_value), index_type);
index = lb_emit_arith(p, Token_Sub,
lb_build_expr(p, ie->index),
lb_const_value(p->module, index_type, *t->EnumeratedArray.min_value),
index_type);
index = lb_emit_conv(p, index, t_int);
}
} else {
index = lb_emit_conv(p, lb_build_expr(p, ie->index), t_int);