def sample_list(self): # [42, 43, 44, 45] rlist = ListRepr(None, signed_repr) rlist.setup() l = ll_newlist(rlist.lowleveltype.TO, 3) ll_setitem(l, 0, 42) ll_setitem(l, -2, 43) ll_setitem_nonneg(l, 2, 44) ll_append(l, 45) return l
def rtyper_makerepr(self, rtyper): listitem = self.listdef.listitem s_value = listitem.s_value if (listitem.range_step is not None and not listitem.mutated and not isinstance(s_value, annmodel.SomeImpossibleValue)): from rpython.rtyper.lltypesystem.rrange import RangeRepr return RangeRepr(listitem.range_step) else: # cannot do the rtyper.getrepr() call immediately, for the case # of recursive structures -- i.e. if the listdef contains itself from rpython.rtyper.lltypesystem.rlist import ListRepr, FixedSizeListRepr item_repr = lambda: rtyper.getrepr(listitem.s_value) if self.listdef.listitem.resized: return ListRepr(rtyper, item_repr, listitem) else: return FixedSizeListRepr(rtyper, item_repr, listitem)