Skip to content

Commit

Permalink
Update __init__.py
Browse files Browse the repository at this point in the history
  • Loading branch information
StunxFS authored Dec 4, 2023
1 parent 5be3916 commit 605c77e
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions rivetc/src/codegen/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1566,14 +1566,14 @@ def gen_expr(self, expr, custom_tmp = None):
if expr.index.has_start:
start = self.gen_expr(expr.index.start)
else:
start = ir.IntLit(ir.UINT_T, "0")
start = ir.IntLit(ir.INT_T, "0")
if expr.index.has_end:
end = self.gen_expr(expr.index.end)
else:
if s.kind == TypeKind.Array:
end = ir.IntLit(ir.UINT_T, s.info.size.lit)
end = ir.IntLit(ir.INT_T, s.info.size.lit)
elif isinstance(left, ir.StringLit):
end = ir.IntLit(ir.UINT_T, left.len)
end = ir.IntLit(ir.INT_T, left.len)
else:
end = None
tmp = self.cur_fn.local_name()
Expand Down Expand Up @@ -1614,17 +1614,17 @@ def gen_expr(self, expr, custom_tmp = None):
ir.InstKind.Call, [
ir.Name("_R4core16array_slice_fromF"),
ir.Inst(ir.InstKind.GetRef, [left]),
ir.IntLit(ir.UINT_T, str(size)),
ir.IntLit(ir.UINT_T, s.info.size.lit), start
ir.IntLit(ir.INT_T, str(size)),
ir.IntLit(ir.INT_T, s.info.size.lit), start
]
)
else:
inst = ir.Inst(
ir.InstKind.Call, [
ir.Name("_R4core11array_sliceF"),
ir.Inst(ir.InstKind.GetRef, [left]),
ir.IntLit(ir.UINT_T, str(size)),
ir.IntLit(ir.UINT_T, s.info.size.lit), start,
ir.IntLit(ir.INT_T, str(size)),
ir.IntLit(ir.INT_T, s.info.size.lit), start,
end
]
)
Expand All @@ -1634,7 +1634,7 @@ def gen_expr(self, expr, custom_tmp = None):
if isinstance(s.info, sym.ArrayInfo):
self.cur_fn.add_call(
"_R4core11array_indexF",
[ir.IntLit(ir.UINT_T, s.info.size.lit), idx]
[ir.IntLit(ir.INT_T, s.info.size.lit), idx]
)
tmp = self.cur_fn.local_name()
expr_typ_ir = self.ir_type(expr.typ)
Expand Down

0 comments on commit 605c77e

Please sign in to comment.