Esempio n. 1
0
 def _really_force(self, optforce):
     if self.mode is mode_string:
         s = self.get_constant_string_spec(mode_string)
         if s is not None:
             c_s = get_const_ptr_for_string(s)
             self.make_constant(c_s)
             return
     else:
         s = self.get_constant_string_spec(mode_unicode)
         if s is not None:
             c_s = get_const_ptr_for_unicode(s)
             self.make_constant(c_s)
             return
     assert self.source_op is not None
     self.box = box = self.source_op.result
     lengthbox = self.getstrlen(optforce, self.mode)
     op = ResOperation(self.mode.NEWSTR, [lengthbox], box)
     if not we_are_translated():
         op.name = 'FORCE'
     optforce.emit_operation(op)
     self.string_copy_parts(optforce, box, CONST_0, self.mode)
Esempio n. 2
0
 def _really_force(self, optforce):
     if self.mode is mode_string:
         s = self.get_constant_string_spec(mode_string)
         if s is not None:
             c_s = get_const_ptr_for_string(s)
             self.make_constant(c_s)
             return
     else:
         s = self.get_constant_string_spec(mode_unicode)
         if s is not None:
             c_s = get_const_ptr_for_unicode(s)
             self.make_constant(c_s)
             return
     assert self.source_op is not None
     self.box = box = self.source_op.result
     lengthbox = self.getstrlen(optforce, self.mode, None)
     op = ResOperation(self.mode.NEWSTR, [lengthbox], box)
     if not we_are_translated():
         op.name = 'FORCE'
     optforce.emit_operation(op)
     self.initialize_forced_string(optforce, box, CONST_0, self.mode)