Example #1
0
 def rtype_method_append(self, hop):
     if getattr(self.listitem, 'hint_maxlength', False):
         v_lst, v_value = hop.inputargs(self, self.item_repr)
         hop.exception_cannot_occur()
         hop.gendirectcall(ll_append_noresize, v_lst, v_value)
     else:
         AbstractListRepr.rtype_method_append(self, hop)
Example #2
0
 def rtype_method_append(self, hop):
     if self.known_maxlength:
         v_lst, v_value = hop.inputargs(self, self.item_repr)
         hop.exception_cannot_occur()
         hop.gendirectcall(ll_append_maxlength, v_lst, v_value)
     else:
         return AbstractListRepr.rtype_method_append(self, hop)
Example #3
0
 def rtype_hint(self, hop):
     optimized = getattr(self.listitem, 'hint_maxlength', False)
     hints = hop.args_s[-1].const
     if 'maxlength' in hints:
         if optimized:
             v_list = hop.inputarg(self, arg=0)
             v_maxlength = self._get_v_maxlength(hop)
             hop.llops.gendirectcall(ll_set_maxlength, v_list, v_maxlength)
             return v_list
     if 'fence' in hints:
         v_list = hop.inputarg(self, arg=0)
         if isinstance(hop.r_result, FixedSizeListRepr):
             if optimized and 'exactlength' in hints:
                 llfn = ll_list2fixed_exact
             else:
                 llfn = ll_list2fixed
             v_list = hop.llops.gendirectcall(llfn, v_list)
         return v_list
     return AbstractListRepr.rtype_hint(self, hop)