Commits

Maciej Fijalkowski committed 1c38dd6

(arigo) simplify

Comments (0)

Files changed (1)

rpython/rtyper/annlowlevel.py

                 return lltype_to_annotation(lltype.Ptr(UNICODE))
 
         def specialize_call(self, hop):
+            from rpython.rtyper.lltypesystem.rstr import (string_repr,
+                                                          unicode_repr)
             hop.exception_cannot_occur()
-            v_ll_str, = hop.inputargs(*hop.args_r)
-            if hop.args_r[0].lowleveltype == hop.r_result.lowleveltype:
-                return hop.genop('same_as', [v_ll_str],
-                                 resulttype = hop.r_result.lowleveltype)
+            if strtype is str:
+                v_ll_str = hop.inputarg(string_repr, 0)
             else:
-                return hop.gendirectcall(hop.args_r[0].ll.ll_chr2str, v_ll_str)
+                v_ll_str = hop.inputarg(unicode_repr, 0)
+            return hop.genop('same_as', [v_ll_str],
+                             resulttype = hop.r_result.lowleveltype)
         
     return hlstr, llstr