def setfield(self, vinst, attr, vvalue, llops, force_cast=False, flags={}): """Write the given attribute (or __class__ for the type) of 'vinst'.""" if (attr in self.my_redirected_fields and not flags.get('access_directly')): mangled_name, r = self.fields[attr] if force_cast: vinst = llops.genop('cast_pointer', [vinst], resulttype=self) ll_setter = self.get_setter(mangled_name) llops.gendirectcall(ll_setter, vinst, vvalue) else: InstanceRepr.setfield(self, vinst, attr, vvalue, llops, force_cast)
def setfield(self, vinst, attr, vvalue, llops, force_cast=False, flags={}): """Write the given attribute (or __class__ for the type) of 'vinst'.""" if not flags.get("access_directly") and attr in self.fields: mangled_name, r = self.fields[attr] if mangled_name in self.my_redirected_fields: if force_cast: vinst = llops.genop("cast_pointer", [vinst], resulttype=self) c_name = inputconst(lltype.Void, mangled_name) llops.genop("promote_virtualizable", [vinst, c_name]) llops.genop("setfield", [vinst, c_name, vvalue]) return InstanceRepr.setfield(self, vinst, attr, vvalue, llops, force_cast)