Exemple #1
0
        def codegen(context, builder, sig, args):
            [instance, attr_v] = args

            utils = _Utils(context, builder, inst_type)
            dataval = utils.get_data_struct(instance)
            ret = getattr(dataval, attr)
            return imputils.impl_ret_borrowed(context, builder, fieldtype, ret)
Exemple #2
0
 def codegen(context, builder, sig, args):
     _, ptr = args
     llrtype = context.get_value_type(inst_type)
     ptr = builder.inttoptr(ptr, ll_types.PointerType(llrtype))
     ret = builder.load(ptr)
     return imputils.impl_ret_borrowed(context, builder, inst_type, ret)
 def struct_getattr_impl(context, builder, typ, val, attr):
     utils = _Utils(context, builder, typ)
     dataval = utils.get_data_struct(val)
     ret = getattr(dataval, attr)
     fieldtype = typ.field_dict[attr]
     return imputils.impl_ret_borrowed(context, builder, fieldtype, ret)