Пример #1
0
def slice_constructor_impl(context, builder, sig, args):
    slice_args = []
    for ty, val, default in zip_longest(sig.args, args, get_defaults(context)):
        if ty in (types.none, None):
            # Omitted or None
            slice_args.append(context.get_constant(types.intp, default))
        else:
            slice_args.append(val)
    start, stop, step = slice_args

    ty = sig.return_type
    sli = make_slice(context, builder, sig.return_type)
    sli.start = start
    sli.stop = stop
    sli.step = step

    res = sli._getvalue()
    return impl_ret_untracked(context, builder, sig.return_type, res)
Пример #2
0
def slice_constructor_impl(context, builder, sig, args):
    slice_args = []
    for ty, val, default in zip_longest(sig.args, args, get_defaults(context)):
        if ty in (types.none, None):
            # Omitted or None
            slice_args.append(context.get_constant(types.intp, default))
        else:
            slice_args.append(val)
    start, stop, step = slice_args

    ty = sig.return_type
    sli = make_slice(context, builder, sig.return_type)
    sli.start = start
    sli.stop = stop
    sli.step = step

    res = sli._getvalue()
    return impl_ret_untracked(context, builder, sig.return_type, res)
Пример #3
0
def slice_constructor_impl(context, builder, sig, args):
    maxint = (1 << (context.address_size - 1)) - 1

    slice_args = []
    for ty, val, default in zip_longest(sig.args, args, (0, maxint, 1)):
        if ty in (types.none, None):
            # Omitted or None
            slice_args.append(context.get_constant(types.intp, default))
        else:
            slice_args.append(val)
    start, stop, step = slice_args

    slice3 = Slice(context, builder)
    slice3.start = start
    slice3.stop = stop
    slice3.step = step

    res = slice3._getvalue()
    return impl_ret_untracked(context, builder, sig.return_type, res)